• Rob Percival's avatar
    Fix use-after-free bug triggered when memory pressure reaches critical · 5f3b3230
    Rob Percival authored
    When memory pressure reaches critical, SingleTreeTracker clears the
    pending_entries_ map. However, if an inclusion check is in progress for
    one or more of those pending entries, LogDnsClient will have a pointer to
    a MerkleAuditProof held in that map. This results in it trying to access
    freed memory.
    
    The fix is to cancel all inclusion checks when this happens. This is done
    by changing LogDnsClient to provide a "resource handle" when it starts a
    query, which can be deleted in order to abort the query. Storing this
    in pending_entries_ assures that all inclusion checks will be aborted
    when pending_entries_ is cleared.
    
    Bug: 811566
    Change-Id: I86b7ff880c050b790d219fa0cd50b42839bc0d3e
    Reviewed-on: https://chromium-review.googlesource.com/939627Reviewed-by: default avatarRyan Sleevi <rsleevi@chromium.org>
    Reviewed-by: default avatarMatt Mueller <mattm@chromium.org>
    Commit-Queue: Rob Percival <robpercival@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#546183}
    5f3b3230
log_dns_client_unittest.cc 34.1 KB