mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #29444: Fixed out-of-bounds buffer access in the group() method of
the match object. Based on patch by WGH.
This commit is contained in:
commit
ef5176769d
3 changed files with 20 additions and 2 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue