Title: _ssl.c uses PyWeakref_GetObject but doesn't incref result
Type: crash Stage: resolved
Components: Extension Modules Versions: Python 3.1, Python 3.2
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: pitrou Nosy List: exarkun, giampaolo.rodola, janssen, pitrou
Priority: normal Keywords: patch

Created on 2010-05-10 23:32 by pitrou, last changed 2010-06-24 23:00 by pitrou. This issue is now closed.

File name Uploaded Description Edit
sslweakref.patch pitrou, 2010-06-24 16:09
Messages (3)
msg105481 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-05-10 23:32
PyWeakref_GetObject() returns a borrowed reference, which can therefore become invalid at any time (especially when the GIL gets released). This provides a way to crash the interpreter deliberately.
The returned reference should be incref'ed immediately before any other action is taken.
msg108526 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-06-24 16:09
Here is a patch. Will commit soon if there's no remarks.
msg108560 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-06-24 23:00
Committed in r82204 (py3k) and r82205 (3.1).
Date User Action Args
2010-06-24 23:00:17pitrousetstatus: open -> closed
resolution: fixed
messages: + msg108560

stage: needs patch -> resolved
2010-06-24 16:09:09pitrousetfiles: + sslweakref.patch

nosy: + exarkun, janssen, giampaolo.rodola
messages: + msg108526

keywords: + patch
2010-05-10 23:32:10pitroucreate