summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorLuca Bellonda <lbellonda@gmail.com>2016-07-13 21:44:16 +0200
committerLuca Bellonda <lbellonda@gmail.com>2016-07-17 14:54:36 +0000
commitd4302ec6936b8b3799a266b640b5d116b3296b29 (patch)
treeff0210f8b26305149fc5580e2f1385fdb1d314ce /src/corelib
parent27fce8c07d93eec39df2440e253f2c0f719b9e19 (diff)
QtCore: Fix QXmlStreamReader for invalid characters in XML 1.0
The XML parser uses fastScanLiteralContent() to read a block of text. The routine was not checking the range of valid characters as defined in the XML standard: https://www.w3.org/TR/2008/REC-xml-20081126/#NT-Char A check has been added to stop reading the bad character. Note that the characters are legal in XML 1.1, but QXmlStreamReader is a well-formed XML 1.0 parser [ChangeLog][QtCore][QXmlStreamReader] Fixed a bug in the XML parser that prevented to load XML that contained invalid characters for XML 1.0. Change-Id: I10aaf84fbf95ccdaf9f6d683ea7c31925efff36d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/xml/qxmlstream.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp
index a235145669..ef7d454dca 100644
--- a/src/corelib/xml/qxmlstream.cpp
+++ b/src/corelib/xml/qxmlstream.cpp
@@ -1175,6 +1175,10 @@ inline int QXmlStreamReaderPrivate::fastScanLiteralContent()
}
// fall through
default:
+ if (c < 0x20) {
+ putChar(c);
+ return n;
+ }
textBuffer += QChar(c);
++n;
}