diff options
author | Markus Armbruster | 2015-11-25 22:23:33 +0100 |
---|---|---|
committer | Markus Armbruster | 2015-11-26 10:07:07 +0100 |
commit | df649835fe48f635a93316fdefe96ced7189316e (patch) | |
tree | 5460f95750d89543d73be1b7c125260f1d8e9f47 /tcg | |
parent | qjson: surprise, allocating 6 QObjects per token is expensive (diff) | |
download | qemu-df649835fe48f635a93316fdefe96ced7189316e.tar.gz qemu-df649835fe48f635a93316fdefe96ced7189316e.tar.xz qemu-df649835fe48f635a93316fdefe96ced7189316e.zip |
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>
Diffstat (limited to 'tcg')
0 files changed, 0 insertions, 0 deletions