From ee698689b4d2e0b5becb47134e4dd4f40d94a299 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milo=C5=A1=20Komar=C4=8Devi=C4=87?= Date: Wed, 19 Oct 2022 12:44:48 +0200 Subject: [PATCH] Exif start can be at any byte in payload, not word aligned --- src/bmffimage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bmffimage.cpp b/src/bmffimage.cpp index a9b35c50..d208ba65 100644 --- a/src/bmffimage.cpp +++ b/src/bmffimage.cpp @@ -499,7 +499,7 @@ void BmffImage::parseTiff(uint32_t root_tag, uint64_t length, uint64_t start) { // hunt for "II" or "MM" const size_t eof = std::numeric_limits::max(); // impossible value for punt size_t punt = eof; - for (size_t i = 0; i < exif.size() - 8 && punt == eof; i += 2) { + for (size_t i = 0; i < exif.size() - 9 && punt == eof; ++i) { if (exif.read_uint8(i) == exif.read_uint8(i + 1)) if (exif.read_uint8(i) == 'I' || exif.read_uint8(i) == 'M') punt = i;