mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #3299: Fix possible crash in the _sre module when given bad
argument values in debug mode. Patch by Victor Stinner.
This commit is contained in:
parent
fd3a60d5ef
commit
efdddd3370
3 changed files with 17 additions and 3 deletions
|
@ -703,6 +703,12 @@ class ReTests(unittest.TestCase):
|
|||
self.assertEqual(pattern.sub('#', 'a\nb\nc'), 'a#\nb#\nc#')
|
||||
self.assertEqual(pattern.sub('#', '\n'), '#\n#')
|
||||
|
||||
def test_dealloc(self):
|
||||
# issue 3299: check for segfault in debug build
|
||||
import _sre
|
||||
long_overflow = sys.maxsize + 2
|
||||
self.assertRaises(TypeError, re.finditer, "a", {})
|
||||
self.assertRaises(OverflowError, _sre.compile, "abc", 0, [long_overflow])
|
||||
|
||||
def run_re_tests():
|
||||
from test.re_tests import benchmarks, tests, SUCCEED, FAIL, SYNTAX_ERROR
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue