* BUG: XmlReader: Don't eat "]" or "-" characters in CDATA or comment sections when they don't terminate the section



git-svn-id: svn://localhost/gambas/trunk@8118 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Tobias Boege 2017-04-02 19:38:12 +00:00
parent 91c170cb45
commit 3db3310dcd

View file

@ -121,6 +121,16 @@ void Reader::DestroyReader()
ClearReader();
}
static void addchars(TextNode *node, char car, size_t num)
{
char *&textContent = node->content;
size_t &lenTextContent = node->lenContent;
textContent = (char*)realloc(textContent, lenTextContent + num);
for (unsigned int i = 0; i < num; ++i)
textContent[lenTextContent + i] = car;
lenTextContent += num;
}
int Reader::ReadChar(char car)
{
#define APPEND(elmt) if(curElmt == 0){}\
@ -144,12 +154,18 @@ int Reader::ReadChar(char car)
if (inCDATA)
{
if (specialTagLevel > CDATA_TAG_STARTCHAR_8 && car != ']' && car != '>')
{
addchars((TextNode *) curNode, ']', specialTagLevel - CDATA_TAG_STARTCHAR_8);
specialTagLevel = CDATA_TAG_STARTCHAR_8;
}
}
if (inComment)
{
if (specialTagLevel > COMMENT_TAG_STARTCHAR_3 && car != '-' && car != '-')
{
addchars((TextNode *) curNode, '-', specialTagLevel - COMMENT_TAG_STARTCHAR_3);
specialTagLevel = COMMENT_TAG_STARTCHAR_3;
}
}
if(car == '<' && !inComment && !inCDATA)//Début de tag