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

Skip to content

Commit 2b0b5ac

Browse files
committed
merge 3.5 (#26171)
2 parents ba77788 + 47b8ba2 commit 2b0b5ac

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
@@ -140,6 +140,9 @@ Core and Builtins
140140
converted to normal strings at run time. Given x=3, then
141141
f'value={x}' == 'value=3'. Patch by Eric V. Smith.
142142

143+
- Issue #26171: Fix possible integer overflow and heap corruption in
144+
zipimporter.get_data().
145+
143146
Library
144147
-------
145148

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)