Bug 499689 - memchr(0,'a',0) evokes segfault
Summary: memchr(0,'a',0) evokes segfault
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc
Version: rawhide
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-05-07 17:01 UTC by Jim Meyering
Modified: 2016-11-24 15:50 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-05-11 23:38:31 UTC
Type: ---


Attachments (Terms of Use)

Description Jim Meyering 2009-05-07 17:01:46 UTC
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 22:19:06 UTC
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 11:15:17 UTC
A related but different issue is
https://bugzilla.redhat.com/show_bug.cgi?id=500136

Comment 3 Jakub Jelinek 2009-05-11 23:38:31 UTC
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 05:55:58 UTC
Thanks.


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