• M
    qjson: Limit number of tokens in addition to total size · df649835
    Markus Armbruster 提交于
    Commit 29c75ddd "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: NMarkus Armbruster <armbru@redhat.com>
    Reviewed-by: NEric Blake <eblake@redhat.com>
    Message-Id: <1448486613-17634-13-git-send-email-armbru@redhat.com>
    df649835
json-streamer.c 3.3 KB