Vulnerable map function is not called on windows

This commit is contained in:
wiredfool 2016-10-03 07:42:48 -07:00
parent aa8cfce94c
commit 22ff3f4358
2 changed files with 4 additions and 1 deletions

View File

@ -154,7 +154,7 @@ class ImageFile(Image.Image):
if d == "raw" and a[0] == self.mode and a[0] in Image._MAPMODES: if d == "raw" and a[0] == self.mode and a[0] in Image._MAPMODES:
try: try:
if hasattr(Image.core, "map"): if hasattr(Image.core, "map"):
# use built-in mapper # use built-in mapper WIN32 only
self.map = Image.core.map(self.filename) self.map = Image.core.map(self.filename)
self.map.seek(o) self.map.seek(o)
self.im = self.map.readimage( self.im = self.map.readimage(

View File

@ -1,7 +1,10 @@
from helper import PillowTestCase, unittest from helper import PillowTestCase, unittest
import sys
from PIL import Image from PIL import Image
@unittest.skipIf(sys.platform.startswith('win32'), "Win32 does not call map_buffer")
class TestMap(PillowTestCase): class TestMap(PillowTestCase):
def test_overflow(self): def test_overflow(self):
# There is the potential to overflow comparisons in map.c # There is the potential to overflow comparisons in map.c