This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/2] malloc: make malloc fail with requests larger than PTRDIFF_MAX


On Fri, 21 Dec 2018, Adhemerval Zanella wrote:

> What about:
> 
>   * Memory allocation functions malloc, calloc, realloc, reallocarray, valloc,
>     pvalloc, memaling, and posix_memalignfail now fail with requests larger

Typos "memaling", "posix_memalignfail".

>     than PTRDIFF_MAX.  This is to avoid potential undefined behavior with
>     pointer subtraction within the allocated object, where results might
>     in ptrdiff_t type overflow.

"might overflow the ptrdiff_t type".

> Does gcc provide an attribute to indicate first argument is the expected 
> result, so it can match the attribute with argument type instead of
> function returned one? Otherwise I think we will need to suppress it 
> from posix_memalign.

No, the alloc_size attribute is inapplicable to posix_memalign.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]