
report at bugs
Apr 30, 2012, 9:55 AM
Post #1 of 19
(141 views)
Permalink
|
|
[issue14700] Integer overflow in classic string formatting
|
|
New submission from Serhiy Storchaka <storchaka [at] gmail>: Check for integer overflow for width and precision is buggy. Just a few examples (on platform with 32-bit int): >>> '%.21d' % 123 '000000000000000000123' >>> '%.2147483648d' % 123 '123' >>> '%.2147483650d' % 123 Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: prec too big >>> '%.21f' % (1./7) '0.142857142857142849213' >>> '%.2147483648f' % (1./7) '0.142857' >>> '%.2147483650f' % (1./7) Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: prec too big ---------- components: Interpreter Core messages: 159707 nosy: storchaka priority: normal severity: normal status: open title: Integer overflow in classic string formatting type: behavior versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker <report [at] bugs> <http://bugs.python.org/issue14700> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
|