[Python-checkins] cpython (2.7): Fixed an infinite loop in zipimport caused by cebcd2fd3e1f (issue #19883).

serhiy.storchaka python-checkins at python.org
Thu Jan 28 17:38:09 EST 2016


https://hg.python.org/cpython/rev/82ee3c24bb86
changeset:   100107:82ee3c24bb86
branch:      2.7
parent:      100104:cebcd2fd3e1f
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Fri Jan 29 00:37:28 2016 +0200
summary:
  Fixed an infinite loop in zipimport caused by cebcd2fd3e1f (issue #19883).

files:
  Modules/zipimport.c |  7 +++----
  1 files changed, 3 insertions(+), 4 deletions(-)


diff --git a/Modules/zipimport.c b/Modules/zipimport.c
--- a/Modules/zipimport.c
+++ b/Modules/zipimport.c
@@ -776,14 +776,14 @@
 
     /* Start of Central Directory */
     count = 0;
+    if (fseek(fp, (long)header_position, 0) == -1) {
+        goto file_error;
+    }
     for (;;) {
         PyObject *t;
         size_t n;
         int err;
 
-        if (fseek(fp, (long)header_position, 0) == -1) {
-            goto file_error;
-        }
         n = fread(buffer, 1, 46, fp);
         if (n < 4) {
             goto eof_error;
@@ -837,7 +837,6 @@
                 goto file_error;
             }
         }
-        header_offset += header_size;
 
         strncpy(path + length + 1, name, MAXPATHLEN - length - 1);
 

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list