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 v2] Add reallocarray function.


* 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.


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