From 97d54d207054dcef595188fc3ee352b096d73c5e Mon Sep 17 00:00:00 2001 From: MaxED Date: Wed, 24 Jun 2015 07:46:08 +0000 Subject: [PATCH] Fixed, DECORATE parser, DB2 bug: the parser didn't check stream length while skipping block comments, so unclosed ones caused EndOfStreamException. --- Source/Core/ZDoom/ZDTextParser.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Source/Core/ZDoom/ZDTextParser.cs b/Source/Core/ZDoom/ZDTextParser.cs index cdadba60..b25d65a9 100644 --- a/Source/Core/ZDoom/ZDTextParser.cs +++ b/Source/Core/ZDoom/ZDTextParser.cs @@ -179,6 +179,13 @@ namespace CodeImp.DoomBuilder.ZDoom char c4, c3 = '\0'; do { + 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. + General.ErrorLogger.Add(ErrorType.Warning, "DECORATE warning in '" + sourcename + "', line " + GetCurrentLineNumber() + ". Block comment is not closed"); + return true; + } + c4 = c3; c3 = (char)datareader.ReadByte(); }