[PATCH] malloc/hooks.c: Correct check for overflow in memalign_check.

Will Newton will.newton@linaro.org
Wed Oct 9 16:19:00 GMT 2013


On 9 October 2013 15:15, Alexander Monakov <amonakov@ispras.ru> wrote:
> On Wed, 9 Oct 2013, Will Newton wrote:
>> +  /* Check for overflow.  */
>> +  if (bytes > SIZE_MAX - alignment - MINSIZE)
>
> At this point no upper bound is established on the value of 'alignment', so
> the test may pass when 'alignment' is so large that right-hand side
> overflows.

Thanks for noticing this. If it's ok I'd like to deal with that issue
as a separate patch though.

-- 
Will Newton
Toolchain Working Group, Linaro



More information about the Libc-alpha mailing list