mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
Issue #14700: Fix two broken and undefined-behaviour-inducing overflow checks in old-style string formatting. Thanks Serhiy Storchaka for report and original patch.
This commit is contained in:
parent
10ba07a39e
commit
99e2e5552a
3 changed files with 9 additions and 2 deletions
|
@ -1197,6 +1197,10 @@ class MixinStrUnicodeUserStringTest:
|
|||
self.checkraises(TypeError, '%10.*f', '__mod__', ('foo', 42.))
|
||||
self.checkraises(ValueError, '%10', '__mod__', (42,))
|
||||
|
||||
# Outrageously large width or precision should raise ValueError.
|
||||
self.checkraises(ValueError, '%%%df' % (2**64), '__mod__', (3.2))
|
||||
self.checkraises(ValueError, '%%.%df' % (2**64), '__mod__', (3.2))
|
||||
|
||||
def test_floatformatting(self):
|
||||
# float formatting
|
||||
for prec in range(100):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue