From 98101c04638fe362083948cfe065877a7fe0d1a5 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Mon, 3 Oct 2016 07:42:48 -0700 Subject: [PATCH] Vulnerable map function is not called on windows --- PIL/ImageFile.py | 2 +- Tests/test_map.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/PIL/ImageFile.py b/PIL/ImageFile.py index b21e9e317..706cbf328 100644 --- a/PIL/ImageFile.py +++ b/PIL/ImageFile.py @@ -154,7 +154,7 @@ class ImageFile(Image.Image): if d == "raw" and a[0] == self.mode and a[0] in Image._MAPMODES: try: if hasattr(Image.core, "map"): - # use built-in mapper + # use built-in mapper WIN32 only self.map = Image.core.map(self.filename) self.map.seek(o) self.im = self.map.readimage( diff --git a/Tests/test_map.py b/Tests/test_map.py index d9b66e965..14bd835a2 100644 --- a/Tests/test_map.py +++ b/Tests/test_map.py @@ -1,7 +1,10 @@ from helper import PillowTestCase, unittest +import sys from PIL import Image + +@unittest.skipIf(sys.platform.startswith('win32'), "Win32 does not call map_buffer") class TestMap(PillowTestCase): def test_overflow(self): # There is the potential to overflow comparisons in map.c