Bug 499689 - memchr(0,'a',0) evokes segfault
memchr(0,'a',0) evokes segfault
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: glibc (Show other bugs)
rawhide
All Linux
low Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-05-07 13:01 EDT by Jim Meyering
Modified: 2016-11-24 10:50 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-05-11 19:38:31 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jim Meyering 2009-05-07 13:01:46 EDT
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:
Comment 1 Bruno Haible 2009-05-08 18:19:06 EDT
There is an email thread about this issue starting at
  http://lists.gnu.org/archive/html/bug-gnulib/2009-05/msg00081.html
Comment 2 Bruno Haible 2009-05-11 07:15:17 EDT
A related but different issue is
https://bugzilla.redhat.com/show_bug.cgi?id=500136
Comment 3 Jakub Jelinek 2009-05-11 19:38:31 EDT
This one is undefined behavior, yet works as it used to work again in glibc 2.10.1 in rawhide.
Comment 4 Jim Meyering 2009-05-12 01:55:58 EDT
Thanks.

Note You need to log in before you can comment on or make changes to this bug.