Fixed, text parsers: the parser could stuck in infinite loop when trying to skip an unclosed block comment.

This commit is contained in:
MaxED 2015-08-28 13:36:36 +00:00
parent 03265d7d5d
commit 54bf4afdff

View file

@ -146,6 +146,7 @@ namespace CodeImp.DoomBuilder.ZDoom
{ {
int offset = skipnewline ? 0 : 1; int offset = skipnewline ? 0 : 1;
char c; char c;
prevstreamposition = datastream.Position; //mxd
do do
{ {
@ -179,13 +180,14 @@ namespace CodeImp.DoomBuilder.ZDoom
{ {
// Skip until */ // Skip until */
char c4, c3 = '\0'; char c4, c3 = '\0';
prevstreamposition = datastream.Position; //mxd
do do
{ {
if(datastream.Position == datastream.Length) //mxd if(datastream.Position == datastream.Length) //mxd
{ {
// ZDoom doesn't give even a warning message about this, so we shouldn't report error or fail parsing. // ZDoom doesn't give even a warning message about this, so we shouldn't report error or fail parsing.
General.ErrorLogger.Add(ErrorType.Warning, "DECORATE warning in '" + sourcename + "', line " + GetCurrentLineNumber() + ". Block comment is not closed."); General.ErrorLogger.Add(ErrorType.Warning, "DECORATE warning in '" + sourcename + "', line " + GetCurrentLineNumber() + ". Block comment is not closed.");
return true; return false;
} }
c4 = c3; c4 = c3;