Commit Graph

58 Commits

Author SHA1 Message Date
Serhiy Storchaka
13ea0c5d9c Fixed an infinite loop in zipimport caused by cebcd2fd3e1f (issue #19883). 2016-01-29 00:37:28 +02:00
Serhiy Storchaka
c4ef384d13 Issue #19883: Fixed possible integer overflows in zipimport. 2016-01-28 21:32:53 +02:00
Benjamin Peterson
5640bbb6c5 reject negative data_size 2016-01-21 22:02:46 -08:00
Benjamin Peterson
64ea192b73 prevent buffer overflow in get_data (closes #26171) 2016-01-20 22:23:44 -08:00
Benjamin Peterson
e4309f7f14 fix refleak in error condition 2016-01-20 22:06:43 -08:00
Benjamin Peterson
384e9cb3a1 finish backing out #19081 2014-02-16 14:46:57 -05:00
Benjamin Peterson
e9aab0fb98 backout #19081 to fix #20621 2014-02-16 14:20:14 -05:00
Gregory P. Smith
aaef0e7821 Remove inaccurate comment and a the related recently added
Py_VerboseFlag print that can never be triggered.

prefix[0] is always equal to 0 at this point in the code.
2014-01-27 22:43:25 -08:00
Gregory P. Smith
027ab39014 Issue #19081: Remove the zipimporter.files reference as the zip TOC
caches are module global in the zip_directory_cache. When it is
updated due to a changed zip file, all zipimporter instances need to
see the same updates TOC cache.  This fixes the bug for the overlooked
submodule import case from the earlier round of changes.  Includes
tests that would fail otherwise.

It also refactors zipimporter_init in the process to make it a bit
easier to read and understand.  Less reuse of the same variable for
multiple purposes and the local path buffer is malloc'ed instead
of consuming a large MAXPATHLEN+2 chunk stack space.
2014-01-27 00:15:10 -08:00
Benjamin Peterson
7251fe10ff fix zipimport ref leak 2014-01-09 09:36:10 -06:00
Gregory P. Smith
6de7260877 cleanup for the issue 19081 fix - pull the file open and close outside of the
zip_searchorder scanning loop in get_module_code().
[already done in 3.3 and 3.4]
2014-01-07 18:39:48 -08:00
Gregory P. Smith
ad3e72557c Should fix the issue19081 fix on Windows. Don't let the previous
posix module ImportError cause the nt module import to fail.
2014-01-07 01:11:09 -08:00
Gregory P. Smith
b48c5d5107 Fixes issue19081: When a zipimport .zip file in sys.path being imported
from is modified during the lifetime of the Python process after
zipimport has already opened and cached the zip's table of contents
it now fstat's the file after opening it upon every attempt to access
anything within and will re-read the table of contents if the .zip file
inode, size or mtime have changed.

It would've been nicer to hold any .zip file used by zipimport open for the
duration of the process but that would be more invasive and add an additional
open file descriptor to all zipimport using processes.  It also would likely
not fix the problem on Windows due to different filesystem semantics.
2014-01-06 09:46:46 -08:00
Jesus Cea
e884be67bd Closes #15897: zipimport.c doesn't check return value of fseek() 2012-10-03 02:13:05 +02:00
Victor Stinner
f58f1c33c1 Issue #12124: zipimport doesn't keep a reference to zlib.decompress() anymore
to be able to unload the module.
2011-05-21 02:13:22 +02:00
Ezio Melotti
c2077b0d9b #11565: Fix several typos. Patch by Piotr Kasprzyk. 2011-03-16 12:34:31 +02:00
Ezio Melotti
24b07bcba3 #11515: fix several typos. Patch by Piotr Kasprzyk. 2011-03-15 18:55:01 +02:00
Brian Curtin
13b43e70e2 Fix #9316. if/is grammar corrections. 2010-07-21 01:35:46 +00:00
Antoine Pitrou
c83ea137d7 Untabify C files. Will watch buildbots. 2010-05-09 14:46:46 +00:00
Nick Coghlan
0194f5bc98 Issue #4512 closeout: Make ZipImport.get_filename() a public method 2009-02-08 03:17:00 +00:00
Nick Coghlan
a2053475bb Fix several issues relating to access to source code inside zipfiles. Initial work by Alexander Belopolsky. See Misc/NEWS in this checkin for details. 2008-12-14 10:54:50 +00:00
Gregory P. Smith
dd96db63f6 This reverts r63675 based on the discussion in this thread:
http://mail.python.org/pipermail/python-dev/2008-June/079988.html

Python 2.6 should stick with PyString_* in its codebase.  The PyBytes_* names
in the spirit of 3.0 are available via a #define only.  See the email thread.
2008-06-09 04:58:54 +00:00
Christian Heimes
593daf545b Renamed PyString to PyBytes 2008-05-26 12:51:38 +00:00
Georg Brandl
6a57c08dc8 #1326: document and test zipimporter.archive and zipimporter.prefix. 2008-05-11 15:05:13 +00:00
Christian Heimes
62a8e95fea Coverity issue CID #197
var_decl: Declared variable "stm" without initializer
ninit_use_in_call: Using uninitialized value "stm" (field "stm".tm_zone uninitialized) in call to function "mktime"
2008-01-18 07:30:20 +00:00