summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFridrich Štrba <fridrich.strba@bluewin.ch>2015-12-21 09:31:05 +0100
committerFridrich Štrba <fridrich.strba@bluewin.ch>2015-12-21 09:31:35 +0100
commite1116a4cfb515b177e7b7203c0f8307431518c49 (patch)
tree07e33032812f864f4a01bfdb614bea4f9f436413
parent46d75c2b3a02873097e3e64eb42c99422eda29d6 (diff)
Some protection against non-empty pp cp and tp + special value of bulletStr
Change-Id: Ifb8a8d287ed0e638c36a483b397f336841439036
-rw-r--r--src/lib/VSDXMLParserBase.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/lib/VSDXMLParserBase.cpp b/src/lib/VSDXMLParserBase.cpp
index ad7300d..fa375c2 100644
--- a/src/lib/VSDXMLParserBase.cpp
+++ b/src/lib/VSDXMLParserBase.cpp
@@ -1105,13 +1105,16 @@ void libvisio::VSDXMLParserBase::readText(xmlTextReaderPtr reader)
switch (tokenId)
{
case XML_CP:
- cp = getIX(reader);
+ if (XML_READER_TYPE_ELEMENT == tokenType)
+ cp = getIX(reader);
break;
case XML_PP:
- pp = getIX(reader);
+ if (XML_READER_TYPE_ELEMENT == tokenType)
+ pp = getIX(reader);
break;
case XML_TP:
- tp = getIX(reader);
+ if (XML_READER_TYPE_ELEMENT == tokenType)
+ tp = getIX(reader);
break;
default:
if (XML_READER_TYPE_TEXT == tokenType || XML_READER_TYPE_SIGNIFICANT_WHITESPACE == tokenType)
@@ -1471,12 +1474,16 @@ void libvisio::VSDXMLParserBase::readParaIX(xmlTextReaderPtr reader)
readByteData(bullet, reader);
break;
case XML_BULLETSTR:
- if (XML_READER_TYPE_ELEMENT == tokenType)
+ if (XML_READER_TYPE_ELEMENT == tokenType && !xmlTextReaderIsEmptyElement(reader))
{
const shared_ptr<xmlChar> stringValue(readStringData(reader), xmlFree);
if (stringValue && !xmlStrEqual(stringValue.get(), BAD_CAST("Themed")))
{
- bulletStr = VSDName(librevenge::RVNGBinaryData(stringValue.get(), xmlStrlen(stringValue.get())), VSD_TEXT_UTF8);
+ unsigned length = xmlStrlen(stringValue.get());
+ const xmlChar *strV = stringValue.get();
+ // The character U+E000 is considered as empty string in VDX produced by Visio 2002
+ if (3 != length || 0xee != strV[0] || 0x80 != strV[1] || 0x80 != strV[2])
+ bulletStr = VSDName(librevenge::RVNGBinaryData(stringValue.get(), xmlStrlen(stringValue.get())), VSD_TEXT_UTF8);
}
}
break;