Fixed an infinite loop in zipimport caused by cebcd2fd3e1f (issue #19883).
diff --git a/Modules/zipimport.c b/Modules/zipimport.c
index 0f68cec..ee44cab 100644
--- 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);