qt6-bb10/tests/auto/corelib/serialization/json/invalidBinaryData
Jüri Valdmann 8e47474baf QJsonDocument: Avoid overflow of string lengths
The added test case contains the binary JSON equivalent of

    ["ž"]

with the modification that the string's length has been set to INT_MAX. In
Value::usedStorage this length is used through the pointer d like so

    s = sizeof(int) + sizeof(ushort) * qFromLittleEndian(*(int *)d);

Because 2 * INT_MAX is UINT_MAX-1, the expression as a whole evaluates to 2,
which is considered a valid storage size. However, when converting this binary
JSON into ordinary JSON we will attempt to construct a QString of length
INT_MAX.

Fixed by using String::isValid instead of Value::usedStorage. This method
already takes care to avoid the overflow problem. Additionally, I've tried in
this patch to clarify the behavior of Value::isValid a bit by writing it in a
style that is hopefully more amenable to structural induction.

Finally, the test case added in my previous patch had the wrong file extension
and is renamed in this one.

Task-number: QTBUG-61969
Change-Id: I45d891f2467a71d8d105822ef7eb1a73c3efa67a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-05-14 10:52:47 +00:00
..
10.bjson Create corelib/serialization and move existing file formats into it 2018-01-26 20:59:50 +00:00
11.bjson Create corelib/serialization and move existing file formats into it 2018-01-26 20:59:50 +00:00
12.bjson Create corelib/serialization and move existing file formats into it 2018-01-26 20:59:50 +00:00
13.bjson Create corelib/serialization and move existing file formats into it 2018-01-26 20:59:50 +00:00
14.bjson Create corelib/serialization and move existing file formats into it 2018-01-26 20:59:50 +00:00
15.bjson Create corelib/serialization and move existing file formats into it 2018-01-26 20:59:50 +00:00
16.bjson Create corelib/serialization and move existing file formats into it 2018-01-26 20:59:50 +00:00
17.bjson Create corelib/serialization and move existing file formats into it 2018-01-26 20:59:50 +00:00
18.bjson Create corelib/serialization and move existing file formats into it 2018-01-26 20:59:50 +00:00
19.bjson Create corelib/serialization and move existing file formats into it 2018-01-26 20:59:50 +00:00
20.bjson Create corelib/serialization and move existing file formats into it 2018-01-26 20:59:50 +00:00
21.bjson Create corelib/serialization and move existing file formats into it 2018-01-26 20:59:50 +00:00
22.bjson Create corelib/serialization and move existing file formats into it 2018-01-26 20:59:50 +00:00
23.bjson Create corelib/serialization and move existing file formats into it 2018-01-26 20:59:50 +00:00
24.bjson Create corelib/serialization and move existing file formats into it 2018-01-26 20:59:50 +00:00
25.bjson Create corelib/serialization and move existing file formats into it 2018-01-26 20:59:50 +00:00
26.bjson Create corelib/serialization and move existing file formats into it 2018-01-26 20:59:50 +00:00
27.bjson Create corelib/serialization and move existing file formats into it 2018-01-26 20:59:50 +00:00
28.bjson Create corelib/serialization and move existing file formats into it 2018-01-26 20:59:50 +00:00
29.bjson Create corelib/serialization and move existing file formats into it 2018-01-26 20:59:50 +00:00
30.bjson Create corelib/serialization and move existing file formats into it 2018-01-26 20:59:50 +00:00
31.bjson Create corelib/serialization and move existing file formats into it 2018-01-26 20:59:50 +00:00
32.bjson Create corelib/serialization and move existing file formats into it 2018-01-26 20:59:50 +00:00
33.bjson Create corelib/serialization and move existing file formats into it 2018-01-26 20:59:50 +00:00
34.bjson Create corelib/serialization and move existing file formats into it 2018-01-26 20:59:50 +00:00
35.bjson Create corelib/serialization and move existing file formats into it 2018-01-26 20:59:50 +00:00
36.bjson Create corelib/serialization and move existing file formats into it 2018-01-26 20:59:50 +00:00
37.bjson Create corelib/serialization and move existing file formats into it 2018-01-26 20:59:50 +00:00
38.bjson QJsonDocument::fromRawData: Fix out-of-bounds access 2018-05-04 11:53:03 +00:00
39.bjson QJsonDocument: Reject objects containing themselves in binary JSON 2018-05-04 12:03:57 +00:00
40.bjson QJsonDocument: Avoid overflow of string lengths 2018-05-14 10:52:47 +00:00
41.bjson QJsonDocument: Avoid overflow of string lengths 2018-05-14 10:52:47 +00:00