[issue14700] Integer overflow in classic string formatting

Serhiy Storchaka report at bugs.python.org
Mon Apr 30 19:56:13 CEST 2012


Serhiy Storchaka <storchaka at gmail.com> added the comment:

> Serhiy, what platform are you on?

32-bit Linux (Ubuntu), gcc 4.6. But it has to happen on any platform
with a 32-bit integer (for 64-bit use 9223372036854775808).

214748364*10/10 == 214748364 -- test passed
214748364*10 + ('8'-'0') == -2147483648 -- oops!

See also how is this problem solved in _struct.c.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14700>
_______________________________________


More information about the Python-bugs-list mailing list