Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Segmentation fault on macOS 10.14 #1877

Description

@radarhere

Over at https://github.com/python-pillow/Pillow, we switched from zlib to zlib-ng in the wheels of our latest release. Since then, a macOS 10.14 user has reported a segmentation fault in python-pillow/Pillow#8750, and it appears that zlib-ng is the key difference.

I’ve created a branch at https://github.com/radarhere/Pillow/tree/zlib_demo. radarhere/Pillow@1a38c92 removes almost all Pillow code to set up a simplified reproduction. With that,

  1. I build the wheel using GitHub Actions - https://github.com/radarhere/Pillow/actions/runs/13469046394
  2. I download the wheel on a macOS 10.14.6 x86_64 machine and install it with python3.11 -m pip install pillow-11.1.0-cp311-cp311-macosx_10_10_x86_64.whl
  3. I run the Python code from PIL import _imaging to trigger the C code

The relevant C code in src/_imaging.c is

z_stream z_stream;
z_stream.zalloc = (alloc_func)NULL;
z_stream.zfree = (free_func)NULL;
z_stream.opaque = (voidpf)NULL;

By itself, that does not produce a problem. When I add in radarhere/Pillow@753d484

inflateInit(&z_stream);

at the end then https://github.com/radarhere/Pillow/actions/runs/13469051411 creates another wheel, and there is a segfault - report.txt

If I change the wheel process to target macOS 11 and build on arm64, and then run the resulting wheel on macOS 15, there is no problem.

Thanks for any help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions