summaryrefslogtreecommitdiff
path: root/Lib/ctypes
diff options
context:
space:
mode:
authorBen Harper <btharper1221@gmail.com>2019-09-10 11:20:15 -0400
committerT. Wouters <thomas@python.org>2019-09-10 08:20:15 -0700
commita9b6033179b64b985394ad351501089a6a94fc9d (patch)
tree9eb94eddcae546954d94b0e80987ff2c1f30f770 /Lib/ctypes
parent912108891db52c2067889be1f4ce5713839807cd (diff)
downloadcpython-git-a9b6033179b64b985394ad351501089a6a94fc9d.tar.gz
bpo-36253: Remove use after free reference in ctypes test suite (GH-12257)
Diffstat (limited to 'Lib/ctypes')
-rw-r--r--Lib/ctypes/test/test_stringptr.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/ctypes/test/test_stringptr.py b/Lib/ctypes/test/test_stringptr.py
index 95cd1614c6..c20951f4ce 100644
--- a/Lib/ctypes/test/test_stringptr.py
+++ b/Lib/ctypes/test/test_stringptr.py
@@ -70,8 +70,8 @@ class StringPtrTestCase(unittest.TestCase):
x = r[0], r[1], r[2], r[3], r[4]
self.assertEqual(x, (b"c", b"d", b"e", b"f", b"\000"))
del buf
- # x1 will NOT be the same as x, usually:
- x1 = r[0], r[1], r[2], r[3], r[4]
+ # Because r is a pointer to memory that is freed after deleting buf,
+ # the pointer is hanging and using it would reference freed memory.
if __name__ == '__main__':
unittest.main()