Skip to content

"SystemError: tile cannot extend outside image" on s390x #3841

@manisandro

Description

@manisandro

Reported downstream at https://bugzilla.redhat.com/show_bug.cgi?id=1706450:

Description of problem:
I am trying to update a few packages (python-matplotlib [1] and python-pikepdf [2]), but they are failing on s390x with "SystemError: tile cannot extend outside image". I have not attempted to update matplotlib on F30, but at least pikepdf continues to work [3] on F30 with its version of pillow.

Version-Release number of selected component (if applicable):
python-pillow-6.0.0-1.fc31

Steps to Reproduce:

  1. Build python-matplotlib or python-pikepdf on Fedora Rawhide

Actual results:

/usr/lib64/python3.7/site-packages/PIL/Image.py:2007: in save
    save_handler(self, fp, filename)
/usr/lib64/python3.7/site-packages/PIL/PngImagePlugin.py:896: in _save
    [("zip", (0, 0)+im.size, 0, rawmode)])
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
im = <PIL.Image.Image image mode=RGBA size=800x600 at 0x3FF8EA5C2B0>
fp = <PIL.PngImagePlugin._idat object at 0x3ff8eade160>
tile = [('zip', (0, 0, 800, 600), 0, 'RGBA')], bufsize = 65536
    def _save(im, fp, tile, bufsize=0):
        """Helper to save image based on tile list
    
        :param im: Image object.
        :param fp: File object.
        :param tile: Tile list.
        :param bufsize: Optional buffer size
        """
    
        im.load()
        if not hasattr(im, "encoderconfig"):
            im.encoderconfig = ()
        tile.sort(key=_tilesort)
        # FIXME: make MAXBLOCK a configuration parameter
        # It would be great if we could have the encoder specify what it needs
        # But, it would need at least the image size in most cases. RawEncode is
        # a tricky case.
        bufsize = max(MAXBLOCK, bufsize, im.size[0] * 4)  # see RawEncode.c
        if fp == sys.stdout:
            fp.flush()
            return
        try:
            fh = fp.fileno()
            fp.flush()
        except (AttributeError, io.UnsupportedOperation):
            # compress to Python file-compatible object
            for e, b, o, a in tile:
                e = Image._getencoder(im.mode, e, a, im.encoderconfig)
                if o > 0:
                    fp.seek(o)
>               e.setimage(im.im, b)
E               SystemError: tile cannot extend outside image
/usr/lib64/python3.7/site-packages/PIL/ImageFile.py:496: SystemError

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugAny unexpected behavior, until confirmed feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions