From 7878eb6ba30a8b84199f3c8fba4cac739e8a788a Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 22 May 2013 09:53:39 +0200 Subject: Fix parsing of long latin strings in the json parser MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Latin1 strings are usually stored as 8 bit data in the json binary format. But that data structure has a size limitation of 16bit, so we need to fall back to storing the string as 16 bit data if it is too long. Task-number: QTBUG-30946 Change-Id: I0069b1367030b0b2f819fd1f04e34c9e2534a2a3 Reviewed-by: Jędrzej Nowacki --- src/corelib/json/qjsonparser.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/json/qjsonparser.cpp b/src/corelib/json/qjsonparser.cpp index 7989d18901..b151af7955 100644 --- a/src/corelib/json/qjsonparser.cpp +++ b/src/corelib/json/qjsonparser.cpp @@ -886,7 +886,8 @@ bool Parser::parseString(bool *latin1) return false; } } - if (ch > 0xff) { + // bail out if the string is not pure latin1 or too long to hold as a latin1string (which has only 16 bit for the length) + if (ch > 0xff || json - start >= 0x8000) { *latin1 = false; break; } -- cgit v1.2.3