RFC: __attribute_alloc_size__ on allocation functions (BZ#23741)
DJ Delorie
dj@redhat.com
Sat Nov 17 16:27:00 GMT 2018
Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
> So I think before adding such annotation we need to discuss whether we
> want to allow such kind of allocation on malloc and mmap functions. To
> comparison:
It's relatively easy to add such a limit to malloc et al; there's
already a "request too big" macro that just needs to be adjusted (it
currently avoids unsigned overflows).
Perhaps a good compromise would be to retain current behavior for 32-bit
targets (where allocations bigger than 2Gb are realistic) but limit them
to PTRDIFF_MAX on 64 bit targets, (where a 5 exabyte allocation is not
reasonable).
More information about the Libc-alpha
mailing list