Description of problem: memchr(0, 'a', 0) can evoke a segfault Version-Release number of selected component (if applicable): glibc-headers-2.9.90-22.x86_64 How reproducible: every time Steps to Reproduce: $ cat k.c #include <string.h> int main() { return !!(memchr (0, 'a', 0)); } $ gcc -O k.c; ./a.out Actual results: Segmentation fault [Exit 139 (SIGSEGV)] Expected results: no segfault Additional info:
There is an email thread about this issue starting at http://lists.gnu.org/archive/html/bug-gnulib/2009-05/msg00081.html
A related but different issue is https://bugzilla.redhat.com/show_bug.cgi?id=500136
This one is undefined behavior, yet works as it used to work again in glibc 2.10.1 in rawhide.
Thanks.