bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: test-memchr failure on rawhide


From: Jim Meyering
Subject: Re: test-memchr failure on rawhide
Date: Fri, 08 May 2009 12:45:00 +0200

Andreas Schwab wrote:
> Jim Meyering <address@hidden> writes:
>> cat > k.c <<\EOF
>> #include <string.h>
>> int main() { return !!(memchr (0, 'a', 0)); }
>> EOF
>> gcc -O k.c; ./a.out
>> Segmentation fault
>> [Exit 139 (SIGSEGV)]
>
> This is not a bug.  NULL is not a valid object pointer.

It may not be a POSIX conformance issue when using NULL (if you're
convinced it is, please explain why), but even if that is, it's just a
technicality.  When the specified length is 0, memchr must not dereference
the pointer.  I could have used a pointer to an object that happens to
be unreadable.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]