This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Oren Milman
Recipients Oren Milman
Date 2017-10-13.16:56:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1507913807.6.0.213398074469.issue31781@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-10-13 16:56:47Oren Milmansetrecipients: + Oren Milman
2017-10-13 16:56:47Oren Milmansetmessageid: <1507913807.6.0.213398074469.issue31781@psf.upfronthosting.co.za>
2017-10-13 16:56:47Oren Milmanlinkissue31781 messages
2017-10-13 16:56:47Oren Milmancreate