Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault Via Resource Exhaustion #71724

Closed
pabstersac mannequin opened this issue Jul 17, 2016 · 2 comments
Closed

Segfault Via Resource Exhaustion #71724

pabstersac mannequin opened this issue Jul 17, 2016 · 2 comments

Comments

@pabstersac
Copy link
Mannequin

pabstersac mannequin commented Jul 17, 2016

BPO 27537
Nosy @ned-deily

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2016-07-17.06:29:51.184>
created_at = <Date 2016-07-17.06:02:28.983>
labels = ['invalid']
title = 'Segfault Via Resource Exhaustion'
updated_at = <Date 2016-07-17.06:29:51.182>
user = 'https://bugs.python.org/pabstersac'

bugs.python.org fields:

activity = <Date 2016-07-17.06:29:51.182>
actor = 'ned.deily'
assignee = 'none'
closed = True
closed_date = <Date 2016-07-17.06:29:51.184>
closer = 'ned.deily'
components = []
creation = <Date 2016-07-17.06:02:28.983>
creator = 'pabstersac'
dependencies = []
files = []
hgrepos = []
issue_num = 27537
keywords = []
message_count = 2.0
messages = ['270611', '270614']
nosy_count = 2.0
nosy_names = ['ned.deily', 'pabstersac']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = 'resolved'
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue27537'
versions = ['Python 2.7']

@pabstersac
Copy link
Mannequin Author

pabstersac mannequin commented Jul 17, 2016

The code is very simple:
import sys
sys.setrecursionlimit(1<<20)
test=lambda test:test(test)
test(test)

It basically works by changing the recursion limit and then starting an infinite recursion, this quickly gives a segfault.
This can be used to crash python.

@ned-deily
Copy link
Member

Sorry, the documentation for sys.setrecursionlimit() explicitly warns you against doing this:

"The highest possible limit is platform-dependent. A user may need to set the limit higher when she has a program that requires deep recursion and a platform that supports a higher limit. This should be done with care, because a too-high limit can lead to a crash."

https://docs.python.org/2.7/library/sys.html#sys.setrecursionlimit

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant