[Bug libstdc++/125981] std::find_if/std::mismatch dereference the past-the-end iterator when the predicate result type has an ADL-reachable operator&&
yanchurkin at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Jun 25 09:33:53 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125981
--- Comment #1 from Ян Чуркин <yanchurkin at gmail dot com> ---
Patch submitted to gcc-patches:
https://gcc.gnu.org/pipermail/gcc-patches/2026-June/721591.html
Forces the predicate/comparator result to bool in std::__find_if,
std::__mismatch and std::__push_heap so that an ADL-reachable,
non-short-circuiting operator&& cannot cause the past-the-end iterator
to be dereferenced. Includes regression tests. Tested on
x86_64-pc-linux-gnu, no regressions.
More information about the Gcc-bugs
mailing list