path: root/src
diff options
authorThiago Macieira <>2016-01-12 13:55:01 -0800
committerThiago Macieira <>2016-01-15 06:38:53 +0000
commit434302eae1a0c5d3016fe07c7d343bdbad118a8a (patch)
tree61e07e4cc73872cf7923ffc47d0d0d9475554eca /src
parent61169b72c24b336af23702fda1e86d1d1c2c8095 (diff)
Fix non-Latin1 strings in QJsonDocument on big-endian platforms
QJsonDocument stores the entire JSON tree in its binary format. Since the binary format is the same on-disk as in-memory, it has a fixed endianness. But when converting from QString to the little-endian format, the code accidentally converted twice (from little endian, to little endian), which resulted in a no-op and the string got stored as big-endian. It's like encrypting with double-ROT13. No new testcase because tst_QtJson::removeNonLatinKey was already failing and gets fixed by this commit. Task-number: QTBUG-50419 Change-Id: I408dcb81ba654c929f25ffff1428cc79472bbe13 Reviewed-by: Olivier Goffart (Woboq GmbH) <> Reviewed-by: Lars Knoll <>
Diffstat (limited to 'src')
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/json/qjson_p.h b/src/corelib/json/qjson_p.h
index 5fc021c841..17f49d41c8 100644
--- a/src/corelib/json/qjson_p.h
+++ b/src/corelib/json/qjson_p.h
@@ -305,7 +305,7 @@ public:
d->length = str.length();
- const qle_ushort *uc = (const qle_ushort *)str.unicode();
+ const ushort *uc = (const ushort *)str.unicode();
for (int i = 0; i < str.length(); ++i)
d->utf16[i] = uc[i];