Closes #26760.
Two changes to src/common/imagtga.cpp:
Reject a header whose declared image size cannot fit the stream, before either allocation. Uncompressed types have to fit exactly. The RLE types are allowed 128:1, since a packet costs 1 + pixelSize input bytes and yields at most 128 * pixelSize output bytes. The check is skipped when GetLength() returns no usable value, so non-seekable streams are unaffected.
Check LastRead() after the header read and after the three uncompressed bulk reads, so a truncated file fails instead of loading. imagpcx.cpp has done this since #26624. DecodeRLE() already validated its own reads, which is why the RLE paths were already rejecting these files.
wxTGAHandler::DoCanRead() gets the same header check, since it was reading an unfilled hdr for streams shorter than 18 bytes.
Two regression tests in tests/image/image.cpp: Both fail on d5aacc4712 and pass with this commit. Also verified against the 3.3.3 release, where src/common/imagtga.cpp is byte-identical to master.
https://github.com/wxWidgets/wxWidgets/pull/26761
(2 files)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
Thanks for fixing this, will merge soon and backport to 3.2.
FWIW I think it would be better/simpler to use ReadAll() instead of Read() followed by LastRead() check, but this is hardly critical.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()