From c75487719c50c765ef6ba3f9ad2d743d1b4ef28d Mon Sep 17 00:00:00 2001 From: MarkLee131 Date: Sun, 29 Mar 2026 18:04:28 +0800 Subject: [PATCH] Fix wrong variable in findXmp XMP trailer search loop Line 182 checks data[xmpPos] instead of data[trailerPos]. The variable xmpPos is constant at this point, so the early-exit condition is never true. The loop checks every byte position against all XMP trailer patterns unnecessarily. Use data[trailerPos] to restore the intended early-exit behavior. --- src/epsimage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/epsimage.cpp b/src/epsimage.cpp index ac5b54ca1d..90b45685ae 100644 --- a/src/epsimage.cpp +++ b/src/epsimage.cpp @@ -179,7 +179,7 @@ void findXmp(size_t& xmpPos, size_t& xmpSize, const byte* data, size_t startPos, // search for valid XMP trailer for (size_t trailerPos = xmpPos + header.size(); trailerPos < size; trailerPos++) { - if (data[xmpPos] != '\x00' && data[xmpPos] != '<') + if (data[trailerPos] != '\x00' && data[trailerPos] != '<') continue; for (const auto& [trailer, readOnly] : xmpTrailers) { if (trailerPos + trailer.size() > size)