https://sourceware.org/bugzilla/show_bug.cgi?id=25479#c7 points out that valgrind annotations could be added to the obstack code, and then we could detect buffer overruns there as well. http://valgrind.org/docs/manual/mc-manual.html#mc-manual.mempools
I wonder though if this could be done in libc first, or maybe gnulib. And perhaps the libiberty copy should be sync'd with one of those.
There are also ASAN annotations available.
(In reply to Tom Tromey from comment #2) > There are also ASAN annotations available. I suppose you are talking about: https://github.com/google/sanitizers/wiki/AddressSanitizerManualPoisoning
(In reply to Simon Marchi from comment #3) > I suppose you are talking about: Yes, thanks for the link. It would also be good to instrument objalloc, which is used by BFD. For that one, maybe in the sanitizer case, every allocation could just be done in a new chunk.