This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH][AArch64] Add rawmemchr
- From: Wilco Dijkstra <Wilco dot Dijkstra at arm dot com>
- To: Alexander Cherepanov <ch3root at openwall dot com>, 'GNU C Library' <libc-alpha at sourceware dot org>
- Cc: nd <nd at arm dot com>
- Date: Thu, 2 Jun 2016 13:48:37 +0000
- Subject: Re: [PATCH][AArch64] Add rawmemchr
- Authentication-results: sourceware.org; auth=none
- Nodisclaimer: True
- References: <AM3PR08MB00888F05E81BE0117C6876AB83420 at AM3PR08MB0088 dot eurprd08 dot prod dot outlook dot com>,<57502FC8 dot 5040804 at openwall dot com>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:23
Alexander Cherepanov wrote:
> Is memchr on your arch guaranteed to work with an infinite size?
Yes it works fine. The AArch64 assembler functions have been carefully
written to avoid overflows on the size as well as end-pointer comparisons.
> In theory, it's guaranteed by C11 and POSIX (e.g. see
> http://open-std.org/jtc1/sc22/wg14/www/docs/n1533.htm ) but IIUC there
> is a sentiment in the glibc community that passing to a library function
> a size greater than the real size of an object is an error. (Would be
> glad to find out I misunderstood something here.)
The rawmemchr API is a bug by itself - it really is memchr with infinite size
(so using it is extremely risky), but making that explicit is by itself not an issue.