[PATCH] PPC Bugz#1877 strncmp() accesses beyond instructed n bytes

Steven Munroe munroesj@us.ibm.com
Thu Nov 17 21:36:00 GMT 2005


Ulrich Drepper wrote:
> Beside the previous comment, it is perfectly fine to read beyond the
> end of the string if the read bytes are never uesed and it can never
> cause a segmentation fault.  We do this in the x86 versions all the time.
>
The problem is that where the end of the string is also the end of the
page is can and does result in a segfault (if the next page is
no-access) on powerpc. The existing test-strncmp.c does not test for, or
detect, this case.

So this is a bug in my code that test-strncmp does not but should
detect. So I thought I was doing the right thing by fixing a bug and
improving the test case to detect future bugs on any platform.



More information about the Libc-alpha mailing list