bug-gnulib
[Top][All Lists]
Advanced

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

Re: test-memchr failure on rawhide


From: Bruno Haible
Subject: Re: test-memchr failure on rawhide
Date: Sat, 9 May 2009 03:29:20 +0200
User-agent: KMail/1.9.9

James Youngman wrote:
> > How many bytes is "the object" large?
> 
> If s is NULL, there _is_ no object.
> ...
> NULL is not a pointer to an object.

This is not what I'm arguing about.

Does memchr(ptr,c,0) for ptr != NULL now access ptr[0] or not?

If yes, then when ptr is a pointer that points past the end of a read-write
memory page and to the beginning of an unreadable memory page (set up like
this with mprotect), then memchr(ptr,c,0) will crash without justification.

If no, then the fact that memchr(NULL,c,0) now crashes implies the existence
of a 'ptr == NULL' test in the implementation of memchr, which slows down
the code execution and whose only purpose is to be maximally picky about a
standard.

In both cases the memchr implementation is deviating from traditional
behaviour and provoking crashes for programs that worked fine earlier.
This is unreasonable.

Bruno




reply via email to

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