1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:34:59 +00:00

LibGfx/TIFF: Reject images with invalid StripByteCounts or StripOffsets

These two arrays should have the exact same size, files not respecting
this condition should be considered as invalid.
This commit is contained in:
Lucas CHOLLET 2023-12-27 21:42:52 -05:00 committed by Andreas Kling
parent 82d40aab18
commit 31b5f17f79

View file

@ -195,6 +195,9 @@ private:
auto const strips_offset = *m_metadata.strip_offsets();
auto const strip_byte_counts = *m_metadata.strip_byte_counts();
if (strips_offset.size() != strip_byte_counts.size())
return Error::from_string_literal("TIFFImageDecoderPlugin: StripsOffset and StripByteCount have different sizes, aborting...");
for (u32 strip_index = 0; strip_index < strips_offset.size(); ++strip_index) {
TRY(m_stream->seek(strips_offset[strip_index]));