mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 01:37:34 +00:00
LibGfx/TIFF: Move check on tag values in its own function
There is only one check for now, but the fuzzer has already found more checks to add :^)
This commit is contained in:
parent
6bc16ad62e
commit
ba84af7c22
1 changed files with 9 additions and 3 deletions
|
@ -42,9 +42,18 @@ public:
|
|||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<void> ensure_baseline_tags_correctness() const
|
||||
{
|
||||
if (m_metadata.strip_offsets()->size() != m_metadata.strip_byte_counts()->size())
|
||||
return Error::from_string_literal("TIFFImageDecoderPlugin: StripsOffset and StripByteCount have different sizes");
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<void> decode_frame()
|
||||
{
|
||||
TRY(ensure_baseline_tags_presence(m_metadata));
|
||||
TRY(ensure_baseline_tags_correctness());
|
||||
auto maybe_error = decode_frame_impl();
|
||||
|
||||
if (maybe_error.is_error()) {
|
||||
|
@ -195,9 +204,6 @@ 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]));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue