summaryrefslogtreecommitdiffstats
path: root/src/xml
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-04-28 15:35:58 +0200
committerLars Knoll <lars.knoll@qt.io>2020-05-10 11:31:57 +0200
commita4eea312ed7b020b1bb686ec1d619b4d1f85abd4 (patch)
tree4e38a50ffad98256126a196f2e21132db66d19fc /src/xml
parentbabcabfbc899d5a72b282f8cf0b510840e91ba0e (diff)
Correctly parse non BMP char refs in the sax parser
Update the auto test accordingly, and at the same time remove all uses of QTextStream (as they aren't required). Change-Id: I71b7cf6a6b54ea59507f27d5d2d04cc5ae5885fc Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Diffstat (limited to 'src/xml')
-rw-r--r--src/xml/sax/qxml.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp
index f5d283d5ac..e98c86979b 100644
--- a/src/xml/sax/qxml.cpp
+++ b/src/xml/sax/qxml.cpp
@@ -7475,7 +7475,12 @@ bool QXmlSimpleReaderPrivate::parseReference()
case DoneD:
tmp = ref().toUInt(&ok, 10);
if (ok) {
- stringAddC(QChar(tmp));
+ if (tmp > 0xffff) {
+ stringAddC(QChar::highSurrogate(tmp));
+ stringAddC(QChar::lowSurrogate(tmp));
+ } else {
+ stringAddC(QChar(tmp));
+ }
} else {
reportParseError(QLatin1String(XMLERR_ERRORPARSINGREFERENCE));
return false;
@@ -7486,7 +7491,12 @@ bool QXmlSimpleReaderPrivate::parseReference()
case DoneH:
tmp = ref().toUInt(&ok, 16);
if (ok) {
- stringAddC(QChar(tmp));
+ if (tmp > 0xffff) {
+ stringAddC(QChar::highSurrogate(tmp));
+ stringAddC(QChar::lowSurrogate(tmp));
+ } else {
+ stringAddC(QChar(tmp));
+ }
} else {
reportParseError(QLatin1String(XMLERR_ERRORPARSINGREFERENCE));
return false;