busybox awk int overflow bug

Denys Vlasenko vda.linux at googlemail.com
Sat Jul 20 19:26:07 UTC 2013


On Fri, Jul 19, 2013 at 4:42 PM, John Spencer
<maillist-busybox at barfooze.de> wrote:
> 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.

Fixed in git. Thanks


More information about the busybox mailing list