Skip to content

A heap-buffer-overflow at Pillow/src/libImaging/Unpack.c:467:50 in unpackP4L #8706

@Wakotu

Description

@Wakotu

Hello, a heap-buffer-overflow reported by ASAN when I fuzz Pillow with google/atheris.

Environment

  • Pillow version: 7.1.2
  • Python version: Python 3.8.10
  • OS version: Ubuntu 20.04.6 LTS

Output

fuzz driver:

import atheris
import io
import sys

with atheris.instrument_imports():
    from PIL import Image

def fuzz_image(data):
    try:
        # Attempt to open the image from the fuzzed data
        image = Image.open(io.BytesIO(data))
        image.load()  # Trigger image processing
    except Exception as e:
        # Handle exceptions (e.g., print or log)
        pass

def main():
    atheris.Setup(sys.argv, fuzz_image)
    atheris.Fuzz()

if __name__ == "__main__":
    main()

error log:
error.log

trigger input:
trigger.txt

Steps to Reproduce

Pull the docker image and run it to a container.

docker pull vueko0/pillow_crash:v1
docker run --rm vueko0/pillow_crash:v1

Enter the container and run following commands:

cd ~/Pillow/
./crash.sh

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    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