Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a9b6033

Browse files
btharperYhg1s
authored andcommitted
bpo-36253: Remove use after free reference in ctypes test suite (GH-12257)
1 parent 9121088 commit a9b6033

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Lib/ctypes/test/test_stringptr.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ def test_functions(self):
7070
x = r[0], r[1], r[2], r[3], r[4]
7171
self.assertEqual(x, (b"c", b"d", b"e", b"f", b"\000"))
7272
del buf
73-
# x1 will NOT be the same as x, usually:
74-
x1 = r[0], r[1], r[2], r[3], r[4]
73+
# Because r is a pointer to memory that is freed after deleting buf,
74+
# the pointer is hanging and using it would reference freed memory.
7575

7676
if __name__ == '__main__':
7777
unittest.main()

0 commit comments

Comments
 (0)