Chet Ramey <[email protected]> writes:
> On 9/29/25 1:00 AM, Martin D Kealey wrote:
>
>> The malloc size warning is concerning, as the excessive “size” is
>> (uint64_t)(-1).
>
> It seems theoretical, since the line in question is
>
> temp = pointer ? realloc (pointer, bytes) : malloc (bytes);
>
> and `bytes' is a size_t, which matches realloc's and malloc's prototypes.
You can probably just add a check add something like:
if (bytes < PTRDIFF_MAX)
{
errno = ENOMEM;
return NULL;
}
to silence it (although I haven't tested it).
Gnulib's lib/xalloc-oversized.h has some macros to help with more
complex cases like generating arrays of integers, etc.
Collin