Skip to content

Limit SAMPLESPERPIXEL to avoid runtime DOS#6700

Merged
hugovk merged 5 commits intopython-pillow:mainfrom
hugovk:security-samples_per_pixel-sec
Oct 29, 2022
Merged

Limit SAMPLESPERPIXEL to avoid runtime DOS#6700
hugovk merged 5 commits intopython-pillow:mainfrom
hugovk:security-samples_per_pixel-sec

Conversation

@hugovk
Copy link
Copy Markdown
Member

@hugovk hugovk commented Oct 29, 2022

A large value in the SAMPLESPERPIXEL tag could lead to a memory and runtime DOS in TiffImagePlugin.py when setting up the context for image decoding.

This was introduced in Pillow 9.2.0, found with OSS-Fuzz and fixed by limiting SAMPLESPERPIXEL to the number of planes that we can decode.

wiredfool and others added 5 commits October 29, 2022 12:06
A large value in the SAMPLESPERPIXEL tag could lead to a memory and
runtime DOS in TiffImagePlugin.py when setting up the context for
image decoding.
Tests/test_file_tiff.py::TestFileTiff::test_oom[Tests/images/oom-225817ca0f8c663be7ab4b9e717b02c661e66834.tif]
  PIL/TiffImagePlugin.py:850: UserWarning: Corrupt EXIF data.  Expecting to read 12 bytes but only got 6. 
    warnings.warn(str(msg))

Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants