Commit fc5c173c authored by Jesus Cea's avatar Jesus Cea

Closes #15897: zipimport.c doesn't check return value of fseek(). Typo

parent f8100534
...@@ -744,7 +744,7 @@ read_directory(PyObject *archive_obj) ...@@ -744,7 +744,7 @@ read_directory(PyObject *archive_obj)
if (fseek(fp, -22, SEEK_END) == -1) { if (fseek(fp, -22, SEEK_END) == -1) {
fclose(fp); fclose(fp);
PyErr_Format(ZipImportError, "can't read Zip file: %R", archive); PyErr_Format(ZipImportError, "can't read Zip file: %U", archive_obj);
return NULL; return NULL;
} }
header_position = ftell(fp); header_position = ftell(fp);
...@@ -861,7 +861,7 @@ fseek_error: ...@@ -861,7 +861,7 @@ fseek_error:
fclose(fp); fclose(fp);
Py_XDECREF(files); Py_XDECREF(files);
Py_XDECREF(nameobj); Py_XDECREF(nameobj);
PyErr_Format(ZipImportError, "can't read Zip file: %R", archive); PyErr_Format(ZipImportError, "can't read Zip file: %U", archive_obj);
return NULL; return NULL;
error: error:
fclose(fp); fclose(fp);
...@@ -934,7 +934,7 @@ get_data(PyObject *archive, PyObject *toc_entry) ...@@ -934,7 +934,7 @@ get_data(PyObject *archive, PyObject *toc_entry)
/* Check to make sure the local file header is correct */ /* Check to make sure the local file header is correct */
if (fseek(fp, file_offset, 0) == -1) { if (fseek(fp, file_offset, 0) == -1) {
fclose(fp); fclose(fp);
PyErr_Format(ZipImportError, "can't read Zip file: %R", archive); PyErr_Format(ZipImportError, "can't read Zip file: %U", archive);
return NULL; return NULL;
} }
...@@ -949,7 +949,7 @@ get_data(PyObject *archive, PyObject *toc_entry) ...@@ -949,7 +949,7 @@ get_data(PyObject *archive, PyObject *toc_entry)
} }
if (fseek(fp, file_offset + 26, 0) == -1) { if (fseek(fp, file_offset + 26, 0) == -1) {
fclose(fp); fclose(fp);
PyErr_Format(ZipImportError, "can't read Zip file: %R", archive); PyErr_Format(ZipImportError, "can't read Zip file: %U", archive);
return NULL; return NULL;
} }
...@@ -973,7 +973,7 @@ get_data(PyObject *archive, PyObject *toc_entry) ...@@ -973,7 +973,7 @@ get_data(PyObject *archive, PyObject *toc_entry)
bytes_read = fread(buf, 1, data_size, fp); bytes_read = fread(buf, 1, data_size, fp);
} else { } else {
fclose(fp); fclose(fp);
PyErr_Format(ZipImportError, "can't read Zip file: %R", archive); PyErr_Format(ZipImportError, "can't read Zip file: %U", archive);
return NULL; return NULL;
} }
fclose(fp); fclose(fp);
......
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