mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Merge pull request #1706 from wiredfool/pcd-segfault
PCD decoder overruns the shuffle buffer, Fixes #568
This commit is contained in:
commit
5ec7fd0ecb
BIN
Tests/images/hopper.pcd
Normal file
BIN
Tests/images/hopper.pcd
Normal file
Binary file not shown.
22
Tests/test_file_pcd.py
Normal file
22
Tests/test_file_pcd.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
from helper import unittest, PillowTestCase, hopper
|
||||
from PIL import Image
|
||||
|
||||
class TestFilePcd(PillowTestCase):
|
||||
|
||||
def test_load_raw(self):
|
||||
im = Image.open('Tests/images/hopper.pcd')
|
||||
im.load() # should not segfault.
|
||||
|
||||
# Note that this image was created with a resized hopper
|
||||
# image, which was then converted to pcd with imagemagick
|
||||
# and the colors are wonky in Pillow. It's unclear if this
|
||||
# is a pillow or a convert issue, as other images not generated
|
||||
# from convert look find on pillow and not imagemagick.
|
||||
|
||||
#target = hopper().resize((768,512))
|
||||
#self.assert_image_similar(im, target, 10)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
@ -47,7 +47,7 @@ ImagingPcdDecode(Imaging im, ImagingCodecState state, UINT8* buf, int bytes)
|
|||
out[0] = ptr[x];
|
||||
out[1] = ptr[(x+4*state->xsize)/2];
|
||||
out[2] = ptr[(x+5*state->xsize)/2];
|
||||
out += 4;
|
||||
out += 3;
|
||||
}
|
||||
|
||||
state->shuffle((UINT8*) im->image[state->y],
|
||||
|
@ -62,7 +62,7 @@ ImagingPcdDecode(Imaging im, ImagingCodecState state, UINT8* buf, int bytes)
|
|||
out[0] = ptr[x+state->xsize];
|
||||
out[1] = ptr[(x+4*state->xsize)/2];
|
||||
out[2] = ptr[(x+5*state->xsize)/2];
|
||||
out += 4;
|
||||
out += 3;
|
||||
}
|
||||
|
||||
state->shuffle((UINT8*) im->image[state->y],
|
||||
|
|
Loading…
Reference in New Issue
Block a user