Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix OOB Read when writing TIFF with custom Metadata #5148

Merged
merged 1 commit into from Dec 28, 2020

Conversation

@wiredfool
Copy link
Member

@wiredfool wiredfool commented Dec 28, 2020

(triggered in Tests/test_file_libtiff.py::TestFileLibTiff::test_custom_metadata)

Valgrind output:

**88** **********************************************************************
**88** Tests/test_file_libtiff.py::TestFileLibTiff::test_custom_metadata
**88** **********************************************************************
==88== Invalid read of size 1
==88==    at 0x890596C: _TIFFSetupFields (in /usr/lib/x86_64-linux-gnu/libtiff.so.5.5.0)
==88==    by 0x8904EEC: TIFFDefaultDirectory (in /usr/lib/x86_64-linux-gnu/libtiff.so.5.5.0)
==88==    by 0x890504C: TIFFCreateDirectory (in /usr/lib/x86_64-linux-gnu/libtiff.so.5.5.0)
==88==    by 0x8912141: ??? (in /usr/lib/x86_64-linux-gnu/libtiff.so.5.5.0)
==88==    by 0x89126EF: TIFFRewriteDirectory (in /usr/lib/x86_64-linux-gnu/libtiff.so.5.5.0)
==88==    by 0x891A2ED: TIFFFlush (in /usr/lib/x86_64-linux-gnu/libtiff.so.5.5.0)
==88==    by 0x87BD5CC: ImagingLibTiffEncode (TiffDecode.c:678)
==88==    by 0x877D519: _encode (encode.c:141)

Passing in a stack allocated array is going to fail, as a reference
is retained to the name and used later when flushing the Tiff to
the file.

==3330==    at 0xBD4110C: _TIFFSetupFields (tif_dirinfo.c:327)

Passing in a stack allocated array is going to fail, as a reference
is retained to the name and used later when flushing the Tiff to
the file.
@radarhere
Copy link
Member

@radarhere radarhere commented Dec 28, 2020

Thanks

@radarhere radarhere merged commit 416f12e into python-pillow:master Dec 28, 2020
50 checks passed
@radarhere radarhere added the TIFF label Dec 28, 2020
radarhere added a commit to radarhere/Pillow that referenced this issue Dec 30, 2020
hugovk added a commit that referenced this issue Dec 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants