Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
authorJeffrey Stedfast <jeff@xamarin.com>2015-02-05 21:41:36 +0300
committerJeffrey Stedfast <jeff@xamarin.com>2015-02-05 21:41:36 +0300
commite4e32eebcea32724889b09f9893230572af6c560 (patch)
treebb8dcacd55ebc99c23e365c0b59eac32b731ec93 /main/src
parent3422508bd8167451275bfdb423f2dd543d958d3e (diff)
[Core] Fixed MSBuildErrorParser to be more robust
Diffstat (limited to 'main/src')
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/MSBuildErrorParser.cs25
1 files changed, 23 insertions, 2 deletions
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/MSBuildErrorParser.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/MSBuildErrorParser.cs
index 83f7a2ad8c..e6ca0e3df2 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/MSBuildErrorParser.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/MSBuildErrorParser.cs
@@ -60,15 +60,31 @@ namespace MonoDevelop.Projects
//
public static Result TryParseLine (string line)
{
+ int originEnd, originStart = 0;
var result = new Result ();
- int originStart = 0;
MoveNextNonSpace (line, ref originStart);
+ if (originStart >= line.Length)
+ return null;
+
//find the origin section
//the filename may include a colon for Windows drive e.g. C:\foo, so ignore colon in first 2 chars
- int originEnd = line[originStart] == ':'? originStart : line.IndexOf (':', originStart + 2) - 1;
+ if (line[originStart] != ':') {
+ if (originStart + 2 >= line.Length)
+ return null;
+
+ if ((originEnd = line.IndexOf (':', originStart + 2) - 1) < 0)
+ return null;
+ } else {
+ originEnd = originStart;
+ }
+
int categoryStart = originEnd + 2;
+
+ if (categoryStart >= line.Length)
+ return null;
+
MovePrevNonSpace (line, ref originEnd);
//if there is no origin section, then we can't parse the message
@@ -77,8 +93,13 @@ namespace MonoDevelop.Projects
//find the category section, if there is one
MoveNextNonSpace (line, ref categoryStart);
+
+ if (categoryStart >= line.Length)
+ return null;
+
int categoryEnd = line.IndexOf (':', categoryStart) - 1;
int messageStart = categoryEnd + 2;
+
if (categoryEnd >= 0) {
MovePrevNonSpace (line, ref categoryEnd);
if (categoryEnd <= categoryStart)