Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
40c9565b
Commit
40c9565b
authored
Mar 09, 2012
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #14211: Oops, I removed the wrong file :-)
parent
2d01dc00
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
38 deletions
+29
-38
Lib/test/crashers/borrowed_ref_1.py
Lib/test/crashers/borrowed_ref_1.py
+29
-0
Lib/test/crashers/borrowed_ref_2.py
Lib/test/crashers/borrowed_ref_2.py
+0
-38
No files found.
Lib/test/crashers/borrowed_ref_1.py
0 → 100644
View file @
40c9565b
"""
_PyType_Lookup() returns a borrowed reference.
This attacks the call in dictobject.c.
"""
class
A
(
object
):
pass
class
B
(
object
):
def
__del__
(
self
):
print
(
'hi'
)
del
D
.
__missing__
class
D
(
dict
):
class
__missing__
:
def
__init__
(
self
,
*
args
):
pass
d
=
D
()
a
=
A
()
a
.
cycle
=
a
a
.
other
=
B
()
del
a
prev
=
None
while
1
:
d
[
5
]
prev
=
(
prev
,)
Lib/test/crashers/borrowed_ref_2.py
deleted
100644 → 0
View file @
2d01dc00
"""
_PyType_Lookup() returns a borrowed reference.
This attacks PyObject_GenericSetAttr().
NB. on my machine this crashes in 2.5 debug but not release.
"""
class
A
(
object
):
pass
class
B
(
object
):
def
__del__
(
self
):
print
(
"hi"
)
del
C
.
d
class
D
(
object
):
def
__set__
(
self
,
obj
,
value
):
self
.
hello
=
42
class
C
(
object
):
d
=
D
()
def
g
():
pass
c
=
C
()
a
=
A
()
a
.
cycle
=
a
a
.
other
=
B
()
lst
=
[
None
]
*
1000000
i
=
0
del
a
while
1
:
c
.
d
=
42
# segfaults in PyMethod_New(__func__=D.__set__, __self__=d)
lst
[
i
]
=
c
.
g
# consume the free list of instancemethod objects
i
+=
1
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment