Repository navigation
Fix loading of oversized ICOs and TIFFs with mismatched JPEG sampling… - #191
Conversation
… factors - PluginICO: reject icons whose pixel count exceeds 4096*1024 (~4M pixels) to prevent memory allocation errors caused by abnormally large dimensions. - LibTIFF4/tif_jpeg.c: comment out the JPEG sampling-factor mismatch check in JPEGComputeStrileWidthHeightBytesPerLine(). The strict check caused JPEG-compressed TIFF images with mismatched sampling factors to fail to load; decoding now proceeds instead of returning early. Signed-off-by: haobinnan <[email protected]>
|
Thanks for the change. I understand the goal is to load JPEG-compressed TIFFs whose sampling factors don’t match. The concern is that commenting out this check allows decoding to continue while the TIFF and JPEG sampling factors may still drive different buffer and output calculations. Could you include a sample file and regression test, then handle the mismatch explicitly and safely? If the decoder can’t safely support a given mismatch, it should reject that case rather than proceed with inconsistent sizing. Here’s a regression test you can suggest for Call |
Decode supported YCbCr sampling mismatches through the full-resolution RGB path, where TIFF raw-plane sizing is not used. Reject unsupported mismatches and add a generated regression fixture that checks decoded pixels against a matching reference. Use division-based ICO pixel-limit validation to prevent signed multiplication overflow, with a header-only crafted ICO regression test. Follow-up to haobinnan's report and compatibility change in PR #191.
|
Okay I've added to the TEST and forked off ur PR retaining commit history for tests |
|
I've also shared the problematic files with you in case you'd like to take a look. Thanks! |
Decode supported YCbCr sampling mismatches through the full-resolution RGB path, where TIFF raw-plane sizing is not used. Reject unsupported mismatches and add a generated regression fixture that checks decoded pixels against a matching reference. Use division-based ICO pixel-limit validation to prevent signed multiplication overflow, with a header-only crafted ICO regression test. Follow-up to haobinnan's report and compatibility change in PR #191.
… factors
PluginICO: reject icons whose pixel count exceeds 4096*1024 (~4M pixels) to prevent memory allocation errors caused by abnormally large dimensions.
LibTIFF4/tif_jpeg.c: comment out the JPEG sampling-factor mismatch check in JPEGComputeStrileWidthHeightBytesPerLine(). The strict check caused JPEG-compressed TIFF images with mismatched sampling factors to fail to load; decoding now proceeds instead of returning early.