Skip to content

Sun Raster files with RLE encoding and depth 1 fail to load #2231

@mrenters

Description

@mrenters

What did you do?

Tried to open a 1-bit RLE encoded Sun Raster file

What did you expect to happen?

Expected image to load

What actually happened?

Got a 'buffer overrun when reading image file' error

What versions of Pillow and Python are you using?

Python 2.7.8, Pillow 3.3.1

Please include code that reproduces the issue and whenever possible, an image that demonstrates the issue. The best reproductions are self-contained scripts with minimal dependencies. If you are using a framework such as plone, django, or buildout, try to replicate the issue just using Pillow.

Use image in attached ZIP file or create a new image in GIMP, 640x400 with white background. Select black brush, draw a line, convert Image->Mode to Indexed, and select black and white (1-bit) palette. Save image as Sun Raster file with RLE encoding.

sunraster.zip

>>> from PIL import Image
>>> im = Image.open('sunraster.im1')
>>> print im.format,im.size, im.mode
SUN (640, 400) 1
>>> im.load()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/PIL/ImageFile.py", line 240, in load
    raise_ioerror(err_code)
  File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/PIL/ImageFile.py", line 59, in raise_ioerror
    raise IOError(message + " when reading image file")
IOError: buffer overrun when reading image file
>>>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions