Core: Fixed problem with ParseXML hanging on single endtag

This commit is contained in:
Mirek Fidler 2023-10-03 00:46:19 +02:00
parent 5933c7cc77
commit eb4ed035e2
4 changed files with 37 additions and 1 deletions

View file

@ -0,0 +1,5 @@
* C:\upp\out\autotest\CLANGx64.Debug.Debug_Full\ParseXMLErrors.exe 03.10.2023 00:45:27, user: cxl
xml = <b> </b>
xml = </b>
e = Unexpected text

View file

@ -0,0 +1,20 @@
#include <Core/Core.h>
using namespace Upp;
CONSOLE_APP_MAIN
{
StdLogSetup(LOG_FILE | LOG_COUT);
for(const char *xml : { " <b> </b> ", "</b>" })
try {
DDUMP(xml);
ParseXML(xml);
}
catch(XmlError e)
{
DDUMP(e);
}
CheckLogEtalon();
}

View file

@ -0,0 +1,10 @@
uses
Core;
file
Etalon.log,
ParseXMLErrors.cpp;
mainconfig
"" = "";

View file

@ -1012,7 +1012,8 @@ static XmlNode sReadXmlNode(XmlParser& p, ParseXmlFilter *filter, dword style)
m.Shrink();
return m;
}
p.ReadText(); // skip empty text
if(p.ReadText().GetCount() == 0) // skip empty text
throw XmlError("Unexpected text");
return m;
}