Bug 1706450 - "SystemError: tile cannot extend outside image" on s390x
Summary: "SystemError: tile cannot extend outside image" on s390x
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-pillow
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Sandro Mani
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: ZedoraTracker 1701609 1701932 1702273 1706300 1715262
TreeView+ depends on / blocked
 
Reported: 2019-05-04 22:34 UTC by Elliott Sales de Andrade
Modified: 2019-06-03 15:06 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-06-03 15:06:38 UTC
Type: Bug


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Github python-pillow Pillow issues 3841 None None None 2019-05-09 13:08:38 UTC

Description Elliott Sales de Andrade 2019-05-04 22:34:22 UTC
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):
6.0.0-1.fc31


Steps to Reproduce:
1. Build python-matplotlib or python-pikepdf on 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


Expected results:
Image should be saved like on the other architectures.


Additional info:
[1] https://koji.fedoraproject.org/koji/taskinfo?taskID=34628582
[2] https://koji.fedoraproject.org/koji/taskinfo?taskID=34609431
[3] https://koji.fedoraproject.org/koji/taskinfo?taskID=34205304

Comment 1 Sandro Mani 2019-05-09 13:08:38 UTC
Taken upstream

Comment 2 Elliott Sales de Andrade 2019-06-01 04:42:12 UTC
I believe this should fix it: https://src.fedoraproject.org/rpms/python-pillow/pull-request/3


Note You need to log in before you can comment on or make changes to this bug.