diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-02-04 20:57:44 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2017-02-04 20:57:44 (GMT) |
commit | ef5176769d5e54374d84b44f8be2c94f6ab909fa (patch) | |
tree | 3ae37f17b11e55714e690eea256dfb7a5fddf26b /Lib/test/test_re.py | |
parent | 26581785f3625e05d888f120dac9087002d5602e (diff) | |
parent | 86e42376c2f41e6601b1844fb127f2f2e7b5349a (diff) | |
download | cpython-ef5176769d5e54374d84b44f8be2c94f6ab909fa.zip cpython-ef5176769d5e54374d84b44f8be2c94f6ab909fa.tar.gz cpython-ef5176769d5e54374d84b44f8be2c94f6ab909fa.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 c90bdc9..1d7fb76 100644 --- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -1821,6 +1821,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): |