[PATCH v2] Add reallocarray function.
Florian Weimer
fw@deneb.enyo.de
Mon Apr 17 14:32:00 GMT 2017
* Dennis Wölfing:
> +static inline bool
> +check_mul_overflow (size_t l, size_t r, INTERNAL_SIZE_T *result)
> +{
> +#if __GNUC__ >= 5
> + return __builtin_mul_overflow (l, r, result);
This is not correct for size_t != INTERNAL_SIZE_T. Either change the
type of result to size_t * (so that the code fails to compile if the
types differ, something which we have not done for a long time), or
add another check against (INTERNAL_SIZE_T) -1.
More information about the Libc-alpha
mailing list