Commit 6efac08
[libc++] Fix vector sanitization annotations on destruction
In D144155/D136765, the asan annotations for std::vector were modified to unpoison freed backing memory on destruction, instead of leaving it
poisoned. However, calling `__clear()` instead of `clear()` skips informing the asan runtime of this decrease in the accessible container size, which
breaks the invariant that the value of `old_mid` should match the value of `new_mid` from the previous call to _sanitizer_annotate_contiguous_container(),
which can trip the sanity checks for the partial poison between [d1, d2) and the container redzone between [d2, c), if enabled. To fix this, ensure that
`clear()` is called instead, as is already done by `__vdeallocate()`.1 parent 5f096fd commit 6efac08
1 file changed
+3
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
244 | | - | |
| 244 | + | |
245 | 245 | | |
246 | 246 | | |
247 | 247 | | |
| |||
520 | 520 | | |
521 | 521 | | |
522 | 522 | | |
523 | | - | |
| 523 | + | |
524 | 524 | | |
525 | 525 | | |
526 | 526 | | |
| |||
732 | 732 | | |
733 | 733 | | |
734 | 734 | | |
735 | | - | |
736 | | - | |
737 | | - | |
738 | | - | |
739 | 735 | | |
740 | 736 | | |
741 | 737 | | |
| |||
759 | 755 | | |
760 | 756 | | |
761 | 757 | | |
762 | | - | |
| 758 | + | |
763 | 759 | | |
764 | 760 | | |
765 | 761 | | |
| |||
0 commit comments