diff options
Diffstat (limited to 'src/corelib/serialization/qxmlstream.cpp')
-rw-r--r-- | src/corelib/serialization/qxmlstream.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/corelib/serialization/qxmlstream.cpp b/src/corelib/serialization/qxmlstream.cpp index 4f282f19c2..0ac5548178 100644 --- a/src/corelib/serialization/qxmlstream.cpp +++ b/src/corelib/serialization/qxmlstream.cpp @@ -980,7 +980,7 @@ inline uint QXmlStreamReaderPrivate::peekChar() bool QXmlStreamReaderPrivate::scanUntil(const char *str, short tokenToInject) { int pos = textBuffer.size(); - int oldLineNumber = lineNumber; + const auto oldLineNumber = lineNumber; uint c; while ((c = getChar()) != StreamEOF) { @@ -1307,6 +1307,11 @@ inline int QXmlStreamReaderPrivate::fastScanName(int *prefix) int n = 0; uint c; while ((c = getChar()) != StreamEOF) { + if (n >= 4096) { + // This is too long to be a sensible name, and + // can exhaust memory + return 0; + } switch (c) { case '\n': case ' ': @@ -3468,7 +3473,7 @@ void QXmlStreamWriter::setAutoFormatting(bool enable) /*! \since 4.4 - Returns \c true if auto formattting is enabled, otherwise \c false. + Returns \c true if auto formatting is enabled, otherwise \c false. */ bool QXmlStreamWriter::autoFormatting() const { |