Description of problem: memchr(ptr,c,0) makes a memory access to *ptr. But according to ISO C 99, memchr(ptr,c,n) must only access the n bytes starting at ptr, not the n+1 bytes starting at ptr. For n=0, it means no memory access to *ptr at all. Version-Release number of selected component (if applicable): How reproducible: Compile and run the attached program. Steps to Reproduce: 1. gcc -O -Wall memchr-bug.c 2. ./a.out Actual results: Segfaults inside memchr: memchr () at ../sysdeps/x86_64/memchr.S:31 31 movdqa (%rdi), %xmm0 Expected results: Exits normally with exit code 0. Additional info: This may be the same bug as https://bugzilla.redhat.com/show_bug.cgi?id=499705 A related but different issue is https://bugzilla.redhat.com/show_bug.cgi?id=499689
Created attachment 343427 [details] test case
Fixed in glibc-2.10.1 in rawhide.