projects
/
python
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9121088
)
bpo-36253: Remove use after free reference in ctypes test suite (GH-12257)
author
Ben Harper
<btharper1221@gmail.com>
Tue, 10 Sep 2019 15:20:15 +0000
(11:20 -0400)
committer
T. Wouters
<thomas@python.org>
Tue, 10 Sep 2019 15:20:15 +0000
(08:20 -0700)
Lib/ctypes/test/test_stringptr.py
patch
|
blob
|
history
diff --git
a/Lib/ctypes/test/test_stringptr.py
b/Lib/ctypes/test/test_stringptr.py
index 95cd1614c6760eb0f1f816b7f9942ca8f08cf6d3..c20951f4ce0016930de71c56b71b5621e4d1d227 100644
(file)
--- 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()