busybox awk int overflow bug

John Spencer maillist-busybox at barfooze.de
Fri Jul 19 14:42:18 UTC 2013


this was reported on irc

"BEGIN{n=(2^31)-1; print n, int(n), n%1, ++n, int(n), n%1}"

$ gawk "BEGIN{n=(2^31)-1; print n, int(n), n%1, ++n, int(n), n%1}"
2147483647 2147483647 0 2147483648 2147483648 0

$ busybox awk "BEGIN{n=(2^31)-1; print n, int(n), n%1, ++n, int(n), n%1}"
2147483647 2147483647 0 2.14748e+09 -2147483648 4.29497e+09

at least the last 2 values returned are bogus, it looks as if the int 
truncation overflowed.


More information about the busybox mailing list