summaryrefslogtreecommitdiffstats
path: root/src/corelib/json/qjson_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-02-15 10:44:54 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-09 10:20:21 +0200
commite1d3687d64a19d27448b3f8247505daa99261ea1 (patch)
tree3792e67b42c833a4a8765f952d4d3f2a2fb4fa63 /src/corelib/json/qjson_p.h
parent9cc106d9d7d951fcf30f4b0f8606afa6b50892ec (diff)
Fix crashes when creating large documents
Compact an object in regular intervals when inserting data into it, to avoid the object becoming huge. Compact an object/array before inserting into another array or object. Check that the document doesn't get so big it's overflowing the internal data structures. Task-number: QTBUG-29288 Change-Id: Id39d80dac1e7d5a11f40819f41b4b336bce16947 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/json/qjson_p.h')
-rw-r--r--src/corelib/json/qjson_p.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/corelib/json/qjson_p.h b/src/corelib/json/qjson_p.h
index 81439a00ce..06885ad972 100644
--- a/src/corelib/json/qjson_p.h
+++ b/src/corelib/json/qjson_p.h
@@ -543,6 +543,9 @@ public:
class Value
{
public:
+ enum {
+ MaxSize = (1<<27) - 1
+ };
union {
uint _dummy;
qle_bitfield<0, 3> type;
@@ -564,7 +567,7 @@ public:
bool isValid(const Base *b) const;
- static int requiredStorage(const QJsonValue &v, bool *compressed);
+ static int requiredStorage(QJsonValue &v, bool *compressed);
static uint valueToStore(const QJsonValue &v, uint offset);
static void copyData(const QJsonValue &v, char *dest, bool compressed);
};