[ASan][libc++] Annotating std::deque with all allocators
authorAdvenam Tacet <advenam.tacet@trailofbits.com>
Tue, 18 Jul 2023 19:15:13 +0000 (21:15 +0200)
committerAdvenam Tacet <advenam.tacet@trailofbits.com>
Thu, 20 Jul 2023 08:17:26 +0000 (10:17 +0200)
commit0a35ac6c2e0cb0160ca2e6cc11644c263692a46d
tree5888f1d0f4495ff92bbab7a60057ed5626ac9b58
parentd16115ddfcc4ec1c032ef6f879e864080a25f03e
[ASan][libc++] Annotating std::deque with all allocators

This patch is part of our efforts to support container annotations with (almost) every allocator.
Annotating std::deque with default allocator is implemented in D132092.

Support in ASan API exests since rG1c5ad6d2c01294a0decde43a88e9c27d7437d157.

The motivation for a research and those changes was a bug, found by Trail of Bits, in a real code where an out-of-bounds read could happen as two strings were compared via a `std::equals` function that took `iter1_begin`, `iter1_end`, `iter2_begin` iterators (with a custom comparison function).
When object `iter1` was longer than `iter2`, read out-of-bounds on `iter2` could happen. Container sanitization would detect it.

If you have any questions, please email:
- advenam.tacet@trailofbits.com
- disconnect3d@trailofbits.com

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D146815
libcxx/include/deque
libcxx/test/libcxx/containers/sequences/deque/asan.pass.cpp
libcxx/test/libcxx/containers/sequences/deque/asan_turning_off.pass.cpp [new file with mode: 0644]