LibGfx/TIFF: Also seek after reading the last tag

The `read_tag()` function is not mandated to keep the reading head at a
meaningful position, so we also need to align the pointer after the last
tag. This solves a bug where reading the last field of an IFD, which is
placed after the tags, was incorrect.
This commit is contained in:
Lucas CHOLLET 2024-02-03 16:35:31 -05:00 committed by Andrew Kaster
parent a43793ee0d
commit 42f29b9670
Notes: sideshowbarker 2024-07-17 02:21:14 +09:00

View File

@ -498,7 +498,6 @@ private:
auto next_tag_offset = TRY(m_stream->tell());
for (u16 i = 0; i < number_of_field; ++i) {
TRY(m_stream->seek(next_tag_offset));
if (auto maybe_error = read_tag(); maybe_error.is_error() && TIFF_DEBUG)
dbgln("Unable to decode tag {}/{}", i + 1, number_of_field);
@ -506,6 +505,7 @@ private:
// IFD Entry
// Size of tag(u16) + type(u16) + count(u32) + value_or_offset(u32) = 12
next_tag_offset += 12;
TRY(m_stream->seek(next_tag_offset));
}
TRY(read_next_idf_offset());