Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b64d96d

Browse filesBrowse files
authored
Merge pull request #4116 from radarhere/memory
Fixed freeing unallocated pointer when resizing with height too large
2 parents 54e5776 + 511aed9 commit b64d96d
Copy full SHA for b64d96d

File tree

Expand file treeCollapse file tree

2 files changed

+9
-7
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+9
-7
lines changed
Open diff view settings
Collapse file

‎Tests/test_image_resample.py‎

Copy file name to clipboardExpand all lines: Tests/test_image_resample.py
+9-5Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,15 @@ class TestImagingResampleVulnerability(PillowTestCase):
1111
# see https://github.com/python-pillow/Pillow/issues/1710
1212
def test_overflow(self):
1313
im = hopper("L")
14-
xsize = 0x100000008 // 4
15-
ysize = 1000 # unimportant
16-
with self.assertRaises(MemoryError):
17-
# any resampling filter will do here
18-
im.im.resize((xsize, ysize), Image.BILINEAR)
14+
size_too_large = 0x100000008 // 4
15+
size_normal = 1000 # unimportant
16+
for xsize, ysize in (
17+
(size_too_large, size_normal),
18+
(size_normal, size_too_large),
19+
):
20+
with self.assertRaises(MemoryError):
21+
# any resampling filter will do here
22+
im.im.resize((xsize, ysize), Image.BILINEAR)
1923

2024
def test_invalid_size(self):
2125
im = hopper()
Collapse file

‎src/libImaging/Resample.c‎

Copy file name to clipboardExpand all lines: src/libImaging/Resample.c
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -627,8 +627,6 @@ ImagingResampleInner(Imaging imIn, int xsize, int ysize,
627627
if ( ! ksize_vert) {
628628
free(bounds_horiz);
629629
free(kk_horiz);
630-
free(bounds_vert);
631-
free(kk_vert);
632630
return NULL;
633631
}
634632

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.