mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
LibGfx/TIFF: Prevent the CCITT decoder to run on non bilevel image
This commit is contained in:
parent
0ef449a588
commit
f6b86096a5
Notes:
sideshowbarker
2024-07-17 02:22:23 +09:00
Author: https://github.com/LucasChollet Commit: https://github.com/SerenityOS/serenity/commit/f6b86096a5 Pull-request: https://github.com/SerenityOS/serenity/pull/22674 Reviewed-by: https://github.com/Hendiadyoin1 Reviewed-by: https://github.com/nico ✅
1 changed files with 5 additions and 1 deletions
|
@ -270,8 +270,12 @@ private:
|
|||
break;
|
||||
}
|
||||
case Compression::CCITT: {
|
||||
// Section 8: Baseline Field Reference Guide
|
||||
// BitsPerSample must be 1, since this type of compression is defined only for bilevel images.
|
||||
if (m_metadata.bits_per_sample()->size() > 1)
|
||||
return Error::from_string_literal("TIFFImageDecoderPlugin: CCITT image with BitsPerSample greater than one, aborting...");
|
||||
return Error::from_string_literal("TIFFImageDecoderPlugin: CCITT image with BitsPerSample greater than one");
|
||||
if (m_metadata.photometric_interpretation() != PhotometricInterpretation::WhiteIsZero && m_metadata.photometric_interpretation() != PhotometricInterpretation::BlackIsZero)
|
||||
return Error::from_string_literal("TIFFImageDecoderPlugin: CCITT compression is used on a non bilevel image");
|
||||
|
||||
ByteBuffer decoded_bytes {};
|
||||
auto decode_ccitt_1D_strip = [&](u32 num_bytes) -> ErrorOr<ReadonlyBytes> {
|
||||
|
|
Loading…
Reference in a new issue