qemu-e2k/qobject
Markus Armbruster df649835fe qjson: Limit number of tokens in addition to total size
Commit 29c75dd "json-streamer: limit the maximum recursion depth and
maximum token count" attempts to guard against excessive heap usage by
limiting total token size (it says "token count", but that's a lie).

Total token size is a rather imprecise predictor of heap usage: many
small tokens use more space than few large tokens with the same input
size, because there's a constant per-token overhead: 37 bytes on my
system.

Tighten this up: limit the token count to 2Mi.  Chosen to roughly
match the 64MiB total token size limit.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <1448486613-17634-13-git-send-email-armbru@redhat.com>
2015-11-26 10:07:07 +01:00
..
Makefile.objs qerror: Finally unused, clean up 2015-06-22 18:20:40 +02:00
json-lexer.c qjson: replace QString in JSONLexer with GString 2015-11-26 09:31:22 +01:00
json-parser.c qjson: surprise, allocating 6 QObjects per token is expensive 2015-11-26 10:07:07 +01:00
json-streamer.c qjson: Limit number of tokens in addition to total size 2015-11-26 10:07:07 +01:00
qbool.c qbool: Make conversion from QObject * accept null 2015-10-29 14:34:44 +01:00
qdict.c qstring: Make conversion from QObject * accept null 2015-10-29 14:34:45 +01:00
qfloat.c qfloat qint: Make conversion from QObject * accept null 2015-10-29 14:34:45 +01:00
qint.c qfloat qint: Make conversion from QObject * accept null 2015-10-29 14:34:45 +01:00
qjson.c qjson: store tokens in a GQueue 2015-11-26 10:07:07 +01:00
qlist.c qlist: Make conversion from QObject * accept null 2015-10-29 14:34:45 +01:00
qnull.c qobject: Add a special null QObject 2015-05-11 08:59:07 -04:00
qstring.c qstring: Make conversion from QObject * accept null 2015-10-29 14:34:45 +01:00