summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-01-14 17:25:24 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-01-14 17:25:24 (GMT)
commitefdddd3370fc646836b6113247159846734fc129 (patch)
treee6756e2bf9607e658ba334ab90ff0e6771500986 /Lib
parentfd3a60d5efb7ad1e2127d66d151c2cc4280b112b (diff)
downloadcpython-efdddd3370fc646836b6113247159846734fc129.zip
cpython-efdddd3370fc646836b6113247159846734fc129.tar.gz
cpython-efdddd3370fc646836b6113247159846734fc129.tar.bz2
Issue #3299: Fix possible crash in the _sre module when given bad
argument values in debug mode. Patch by Victor Stinner.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_re.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py
index 56056da..456917a 100644
--- a/Lib/test/test_re.py
+++ b/Lib/test/test_re.py
@@ -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