This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH 1/2] malloc/malloc.c: Validate SIZE passed to aligned_alloc.
- From: Paul Eggert <eggert at cs dot ucla dot edu>
- To: Will Newton <will dot newton at linaro dot org>, libc-alpha at sourceware dot org
- Cc: Patch Tracking <patches at linaro dot org>
- Date: Thu, 07 Nov 2013 09:48:59 -0800
- Subject: Re: [PATCH 1/2] malloc/malloc.c: Validate SIZE passed to aligned_alloc.
- Authentication-results: sourceware.org; auth=none
- References: <527BD0C3 dot 4010607 at linaro dot org>
On 11/07/2013 09:41 AM, Will Newton wrote:
> The ISO C11 standard specifies that a SIZE passed to aligned_alloc
> must be a multiple of ALIGNMENT. Aliasing aligned_alloc to memalign
> does not enforce this restriction, so create a new function that
> does this validation.
This doesn't look right. See the NEWS file's entry for glibc 2.16, which says:
+ aligned_alloc. NB: The code is deliberately allows the size parameter
to not be a multiple of the alignment. This is a moronic requirement
in the standard but it is only a requirement on the caller, not the