Commit 13ea0c5d authored by Serhiy Storchaka's avatar Serhiy Storchaka

Fixed an infinite loop in zipimport caused by cebcd2fd3e1f (issue #19883).

parent c4ef384d
...@@ -776,14 +776,14 @@ read_directory(const char *archive) ...@@ -776,14 +776,14 @@ read_directory(const char *archive)
/* Start of Central Directory */ /* Start of Central Directory */
count = 0; count = 0;
if (fseek(fp, (long)header_position, 0) == -1) {
goto file_error;
}
for (;;) { for (;;) {
PyObject *t; PyObject *t;
size_t n; size_t n;
int err; int err;
if (fseek(fp, (long)header_position, 0) == -1) {
goto file_error;
}
n = fread(buffer, 1, 46, fp); n = fread(buffer, 1, 46, fp);
if (n < 4) { if (n < 4) {
goto eof_error; goto eof_error;
...@@ -837,7 +837,6 @@ read_directory(const char *archive) ...@@ -837,7 +837,6 @@ read_directory(const char *archive)
goto file_error; goto file_error;
} }
} }
header_offset += header_size;
strncpy(path + length + 1, name, MAXPATHLEN - length - 1); strncpy(path + length + 1, name, MAXPATHLEN - length - 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment