Skip to content

Commit 0e4fc34

Browse files
MarkLee131mergify[bot]
authored andcommitted
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. (cherry picked from commit c754877)
1 parent 2cd987a commit 0e4fc34

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/epsimage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ void findXmp(size_t& xmpPos, size_t& xmpSize, const byte* data, size_t startPos,
180180

181181
// search for valid XMP trailer
182182
for (size_t trailerPos = xmpPos + header.size(); trailerPos < size; trailerPos++) {
183-
if (data[xmpPos] != '\x00' && data[xmpPos] != '<')
183+
if (data[trailerPos] != '\x00' && data[trailerPos] != '<')
184184
continue;
185185
for (const auto& [trailer, readOnly] : xmpTrailers) {
186186
if (trailerPos + trailer.size() > size)

0 commit comments

Comments
 (0)