TUESDAY, SEPTEMBER 1, 2026
gcc
Fix iterator dereference in gcov's tombstone_subsequence_p.
Prevents potential crash in gcov by guarding iterator dereference.
This commit adds a guard to prevent dereferencing an iterator past the end of the haystack in gcov.cc’s tombstone_subsequence_p function. This addresses a bug where the haystack could be exhausted before the needle, leading to an ASAN-detected issue.
In Details
The tombstone_subsequence_p function in gcov.cc incorrectly dereferenced an iterator when the haystack was exhausted before the needle. This commit adds a check to ensure the iterator is valid before dereferencing, fixing a bug found by ASAN.
For Context
- ASAN
- AddressSanitizer, a fast memory error detector for C/C++ that finds use-after-free, heap-buffer-overflow, use-after-return, and other memory errors.
- gcov
- A code coverage analysis tool for GCC.