diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-02-04 20:55:40 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2017-02-04 20:55:40 (GMT) |
commit | 86e42376c2f41e6601b1844fb127f2f2e7b5349a (patch) | |
tree | c0f806005f196f632922d5f2ea4d3d813c4e26a9 /Lib/test/test_re.py | |
parent | 75c0d4f6bb97e723adc3a03c0ff6aaaee0c6981a (diff) | |
parent | 7e10dbbd45503268f7bb3b241e30745df6c91b99 (diff) | |
download | cpython-86e42376c2f41e6601b1844fb127f2f2e7b5349a.zip cpython-86e42376c2f41e6601b1844fb127f2f2e7b5349a.tar.gz cpython-86e42376c2f41e6601b1844fb127f2f2e7b5349a.tar.bz2 |
Issue #29444: Fixed out-of-bounds buffer access in the group() method of
the match object. Based on patch by WGH.
Diffstat (limited to 'Lib/test/test_re.py')
-rw-r--r-- | Lib/test/test_re.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py index 4bdaa4b..b945cf0 100644 --- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -1824,6 +1824,16 @@ SUBPATTERN None 0 0 warnings.simplefilter('error', BytesWarning) self.assertNotEqual(pattern3, pattern1) + def test_bug_29444(self): + s = bytearray(b'abcdefgh') + m = re.search(b'[a-h]+', s) + m2 = re.search(b'[e-h]+', s) + self.assertEqual(m.group(), b'abcdefgh') + self.assertEqual(m2.group(), b'efgh') + s[:] = b'xyz' + self.assertEqual(m.group(), b'xyz') + self.assertEqual(m2.group(), b'') + class PatternReprTests(unittest.TestCase): def check(self, pattern, expected): |