Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Sun, 6 Nov 2011 15:24:00 +0100
From: Pascal Cuoq <>
Subject: Undefined behavior in atoi()


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 (, 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().



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.