diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-02-04 20:53:57 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2017-02-04 20:53:57 (GMT) |
commit | 7e10dbbd45503268f7bb3b241e30745df6c91b99 (patch) | |
tree | f85d0be894a656f4c6dd473030a3e69ad9cddd6f /Lib | |
parent | c7611362b425277da80b2397e0abedee58138996 (diff) | |
download | cpython-7e10dbbd45503268f7bb3b241e30745df6c91b99.zip cpython-7e10dbbd45503268f7bb3b241e30745df6c91b99.tar.gz cpython-7e10dbbd45503268f7bb3b241e30745df6c91b99.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')
-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 0834fe0..9acd5ab 100644 --- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -1679,6 +1679,16 @@ SUBPATTERN None self.checkPatternError(r'(?<>)', 'unknown extension ?<>', 1) self.checkPatternError(r'(?', 'unexpected end of pattern', 2) + 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): |