mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
Core: Fixed problem with ParseXML hanging on single endtag
This commit is contained in:
parent
5933c7cc77
commit
eb4ed035e2
4 changed files with 37 additions and 1 deletions
5
autotest/ParseXMLErrors/Etalon.log
Normal file
5
autotest/ParseXMLErrors/Etalon.log
Normal 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
|
||||
20
autotest/ParseXMLErrors/ParseXMLErrors.cpp
Normal file
20
autotest/ParseXMLErrors/ParseXMLErrors.cpp
Normal 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();
|
||||
}
|
||||
10
autotest/ParseXMLErrors/ParseXMLErrors.upp
Normal file
10
autotest/ParseXMLErrors/ParseXMLErrors.upp
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
uses
|
||||
Core;
|
||||
|
||||
file
|
||||
Etalon.log,
|
||||
ParseXMLErrors.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "";
|
||||
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue