[PATCH] Improve check against integer wraparound in hcreate_r [BZ #18240]

Szabolcs Nagy szabolcs.nagy@arm.com
Mon Feb 1 17:12:00 GMT 2016


On 01/02/16 17:05, Andreas Schwab wrote:
> Szabolcs Nagy <szabolcs.nagy@arm.com> writes:
> 
>> i think the test-skeleton changes malloc behaviour
>> in weird ways, but i'm not yet sure what's going on.
> 
>   mallopt (M_PERTURB, 42);
> 

ok, so if the only line in main() is

  calloc(INT_MAX-2, 24);

then it does the memset, but if i do

  calloc (500, 24);
  calloc (INT_MAX-2, 24);

then it does not, however

  mallopt (M_PERTURB, 42);
  calloc (500, 24);
  calloc (INT_MAX-2, 24);

again does the memset (and this is what happens
in the actual test).

given the unreliable calloc behaviour i think
glibc should avoid such tests.

does it affect other 64bit targets?



More information about the Libc-alpha mailing list