Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 47b8ba2

Browse files
committed
merge 3.4 (#26171)
2 parents d4d7737 + c4032da commit 47b8ba2

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ Core and Builtins
5050
__bytes__, __trunc__, and __float__ returning instances of subclasses of
5151
bytes, int, and float to subclasses of bytes, int, and float correspondingly.
5252

53+
- Issue #26171: Fix possible integer overflow and heap corruption in
54+
zipimporter.get_data().
55+
5356
Library
5457
-------
5558

Modules/zipimport.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,6 +1127,11 @@ get_data(PyObject *archive, PyObject *toc_entry)
11271127
}
11281128
file_offset += l; /* Start of file data */
11291129

1130+
if (data_size > LONG_MAX - 1) {
1131+
fclose(fp);
1132+
PyErr_NoMemory();
1133+
return NULL;
1134+
}
11301135
bytes_size = compress == 0 ? data_size : data_size + 1;
11311136
if (bytes_size == 0)
11321137
bytes_size++;

0 commit comments

Comments
 (0)