summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2021-04-14 22:13:32 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-04-16 16:50:59 +0000
commit8e76959c57bce3ade12492c288a078afd384012b (patch)
tree311624dbbdaed5e0e39a44ea616b176b66bb7337 /src
parent2818d7ce3ef75b5a21622dbac56647c5d817e529 (diff)
Don't parse XML symbols longer than 4096 characters
It is slow and will use too much memory. Fixes: QTBUG-91889 Change-Id: I45c5e6038357c87bbb85b1ace17ef39a2a814ea0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 38e111158a38507c63fd70f9ee18b9116b537976) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/serialization/qxmlstream.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/corelib/serialization/qxmlstream.cpp b/src/corelib/serialization/qxmlstream.cpp
index e56877082b..f298ef1702 100644
--- a/src/corelib/serialization/qxmlstream.cpp
+++ b/src/corelib/serialization/qxmlstream.cpp
@@ -1298,6 +1298,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 ' ':