This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] PPC Bugz#1877 strncmp() accesses beyond instructed nbytes
- From: Steven Munroe <munroesj at us dot ibm dot com>
- To: Ulrich Drepper <drepper at redhat dot com>
- Cc: libc-alpha at sources dot redhat dot com
- Date: Thu, 17 Nov 2005 15:39:49 -0600
- Subject: Re: [PATCH] PPC Bugz#1877 strncmp() accesses beyond instructed nbytes
- References: <437CD81B.6010907@us.ibm.com> <437CF363.2070809@redhat.com>
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.