your mail

Khem Raj raj.khem at gmail.com
Thu Jan 15 00:12:32 UTC 2009


On (14/01/09 17:07), Natanael Copa wrote:
> Hi,
> 
> This test program segfaults for me on x86, hardened gcc-4.3.2 and
> uclibc-0.9.30:
> 
> #include <stdio.h>
> #include <ctype.h>
> int main(void) {
> 	printf("%i\n", isalnum(0x10000));
> 	return 0;
> }
> 
> 
> If the ctype.h include is commented out it works as expected.
This sounds a bug to me.
with ctype.h included it used the isalnum macro which
then does a lookup in an array of 256 elements and the argument serves
as array index which in your case is 0x10000 is way beyond the size of
array.

Currently if you use the valid range i.e upto 255 it will work as
expected but beyond that it will be accessing outside the array and you
will get random values.

If you do not include ctype.h then it falls back to normal libc
implementation which works and handles the cases beyond the ASCII range

Thx

-Khem


More information about the uClibc mailing list