Limit the nesting depth of the Json parser
authorLars Knoll <lars.knoll@nokia.com>
Sat, 12 May 2012 10:09:35 +0000 (12:09 +0200)
committerQt by Nokia <qt-info@nokia.com>
Wed, 16 May 2012 02:25:11 +0000 (04:25 +0200)
commit1756a84756807a9849aa507e77845dfdf31b8020
tree0ed4ff43ba687440a6a2c2a52da183f752465f51
parentd5000e82e3d17532b76d5a69fd35ac4e8f3b9d18
Limit the nesting depth of the Json parser

The parser is recursive and too deeply nested json would
cause it to exhaust the available stack space leading to
crashes.

We now abort parsing with a DeepNesting parse error if the
document is too deeply nested. The current nesting limit
is set to 1024, which should be more then enough for any
real JSON data set.

Change-Id: I4adea3fd727149f7342536d73cf4530361a0a3a1
Reviewed-by: Jamey Hicks <jamey.hicks@nokia.com>
Reviewed-by: Denis Dzyubenko <denis.dzyubenko@nokia.com>
src/corelib/json/qjsondocument.h
src/corelib/json/qjsonparser.cpp
src/corelib/json/qjsonparser_p.h
tests/auto/corelib/json/tst_qtjson.cpp