summaryrefslogtreecommitdiffstats
path: root/Lib/test/crashers
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2007-09-05 07:51:21 (GMT)
committerArmin Rigo <arigo@tunes.org>2007-09-05 07:51:21 (GMT)
commit362bb5150352603394aacc1d7d0592938962fe92 (patch)
treec468cb0368208080011d2a1d500c162a208d9d0e /Lib/test/crashers
parent4c1cb7ea8e35e3df5d5a9fc5640fefe89a238d31 (diff)
downloadcpython-362bb5150352603394aacc1d7d0592938962fe92.zip
cpython-362bb5150352603394aacc1d7d0592938962fe92.tar.gz
cpython-362bb5150352603394aacc1d7d0592938962fe92.tar.bz2
PyDict_GetItem() returns a borrowed reference.
There are probably a number of places that are open to attacks such as the following one, in bltinmodule.c:min_max().
Diffstat (limited to 'Lib/test/crashers')
-rw-r--r--Lib/test/crashers/borrowed_ref_3.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/crashers/borrowed_ref_3.py b/Lib/test/crashers/borrowed_ref_3.py
new file mode 100644
index 0000000..f241108
--- /dev/null
+++ b/Lib/test/crashers/borrowed_ref_3.py
@@ -0,0 +1,14 @@
+"""
+PyDict_GetItem() returns a borrowed reference.
+There are probably a number of places that are open to attacks
+such as the following one, in bltinmodule.c:min_max().
+"""
+
+class KeyFunc(object):
+ def __call__(self, n):
+ del d['key']
+ return 1
+
+
+d = {'key': KeyFunc()}
+min(range(10), **d)