mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 18:06:18 +03:00
Merge pull request #2813 from wiredfool/issue_2811
Permit LZW code lengths up to 12 bits in GIF decode
This commit is contained in:
commit
f5e4338b86
BIN
Tests/images/issue_2811.gif
Normal file
BIN
Tests/images/issue_2811.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.8 KiB |
|
@ -546,6 +546,13 @@ class TestFileGif(PillowTestCase):
|
|||
finally:
|
||||
GifImagePlugin._FORCE_OPTIMIZE = False
|
||||
|
||||
def test_lzw_bits(self):
|
||||
# see https://github.com/python-pillow/Pillow/issues/2811
|
||||
im = Image.open('Tests/images/issue_2811.gif')
|
||||
|
||||
self.assertEqual(im.tile[0][3][0], 11) # LZW bits
|
||||
# codec error prepatch
|
||||
im.load()
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
|
@ -71,7 +71,7 @@ ImagingGifDecode(Imaging im, ImagingCodecState state, UINT8* buffer, int bytes)
|
|||
if (!state->state) {
|
||||
|
||||
/* Initialise state */
|
||||
if (context->bits < 0 || context->bits > 8) {
|
||||
if (context->bits < 0 || context->bits > 12) {
|
||||
state->errcode = IMAGING_CODEC_CONFIG;
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user