[issue31781] crashes when calling methods of an uninitialized zipimport.zipimporter object

2017-10-20 Thread Brett Cannon

Brett Cannon  added the comment:

As always, thanks for the fix, Oren!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31781] crashes when calling methods of an uninitialized zipimport.zipimporter object

2017-10-20 Thread Brett Cannon

Brett Cannon  added the comment:


New changeset db60a5bfa5d5f7a6f1538cc1fe76f0fda57b524e by Brett Cannon (Oren 
Milman) in branch 'master':
bpo-31781: Prevent crashes when calling methods of an uninitialized 
zipimport.zipimporter object (GH-3986)
https://github.com/python/cpython/commit/db60a5bfa5d5f7a6f1538cc1fe76f0fda57b524e


--
nosy: +brett.cannon

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31781] crashes when calling methods of an uninitialized zipimport.zipimporter object

2017-10-13 Thread Oren Milman

Change by Oren Milman :


--
keywords: +patch
pull_requests: +3962
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31781] crashes when calling methods of an uninitialized zipimport.zipimporter object

2017-10-13 Thread Oren Milman

New submission from Oren Milman :

The following code crashes:
import zipimport
zi = zipimport.zipimporter.__new__(zipimport.zipimporter)
zi.find_module('foo')

This is because get_module_info() (in Modules/zipimport.c) assumes that the
zipimporter object is initialized, so it assumes that `self->prefix` is not
NULL, and passes it to make_filename(), which crashes.

get_module_code() makes the same assumption, and 
zipimport_zipimporter_get_data_impl()
assumes that `self->archive` is not NULL, and passes it to 
PyUnicode_GET_LENGTH(),
which crashes.
Thus, every method of an uninitialized zipimporter object might crash.


I would open a PR to fix this soon.

--
components: Extension Modules
messages: 304346
nosy: Oren Milman
priority: normal
severity: normal
status: open
title: crashes when calling methods of an uninitialized zipimport.zipimporter 
object
type: crash
versions: Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com