[PATCH v3] malloc: make malloc fail with requests larger than PTRDIFF_MAX (BZ#23741)
Joseph Myers
joseph@codesourcery.com
Wed Apr 17 21:42:00 GMT 2019
On Tue, 9 Apr 2019, Adhemerval Zanella wrote:
> As discussed previously on libc-alpha [1], this patch follows up the idea
> and add both the __attribute_alloc_size__ on malloc functions (malloc,
> calloc, realloc, reallocarray, valloc, pvalloc, memaling, and
> posix_memalign) and limit maximum requested allocation size to up
> PTRDIFF_MAX (taking into consideration internal padding and alignment).
__attribute_alloc_size__ is for functions that return a pointer. That is,
it *cannot* be applied to posix_memalign (see remarks in
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87683>).
This is an issue with the proposed commit message and ChangeLog entry, not
the patch itself which doesn't appear to apply the attribute to
posix_memalign after all. The commit message should discuss why the
attribute is not applied to posix_memalign, and the ChangeLog entry should
not say it's being applied there.
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Libc-alpha
mailing list