Tuesday 19 January 2010

The Missing Bus Error

Apple was slammed for not fixing an exploitable bug. That made me curious and I compiled and ran the following:

#include
#include

int
main()
{
char s[]="111.111111...11";

float a=atof(s);
printf("%f",a);
}

which is said to cause a bus error. However:

Opportunity:misc ullrich$ gcc -o buserror buserror.c
Opportunity:misc ullrich$ ./buserror
111.111115Opportunity:misc ullrich$

on my trusty MacBook, which looks more like a rounding error to me. Maybe they just fixed it - I use 10.6.2

No comments:

Post a Comment