Date: Sun, 6 Nov 2011 15:24:00 +0100 From: Pascal Cuoq <pascal.cuoq@...il.com> To: musl@...ts.openwall.com Subject: Undefined behavior in atoi() Hello, the attached patch against musl-0.8.3 removes an undefined behavior when atoi() is applied to the representation of INT_MIN. The undefined behavior is not observable if the compiler implements 2's complement for signed arithmetic overflows, but the compiler doesn't have to. On the other hand, C99 mandates either two's complement's lopsided representation of integers or other, symmetrical, representations (126.96.36.199), so I think the patch is an overall improvement. The patch applies in musl-0.8.3/src/stdlib/ and contains identical changes for atol() and atoll(). Regards, Pascal Content of type "text/html" skipped Download attachment "patch_atoi" of type "application/octet-stream" (1224 bytes)
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.