Skip to content

Fix wrong variable in findXmp XMP trailer search loop#9284

Open
MarkLee131 wants to merge 1 commit intoExiv2:mainfrom
MarkLee131:fix/eps-findxmp-trailer-variable
Open

Fix wrong variable in findXmp XMP trailer search loop#9284
MarkLee131 wants to merge 1 commit intoExiv2:mainfrom
MarkLee131:fix/eps-findxmp-trailer-variable

Conversation

@MarkLee131
Copy link
Copy Markdown

Fix #9283:

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.

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.
Copilot AI review requested due to automatic review settings March 29, 2026 15:07
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes an incorrect buffer index used during XMP trailer scanning in findXmp(), restoring the intended early-exit optimization and avoiding unnecessary comparisons across the entire remaining buffer.

Changes:

  • Correct the trailer pre-filter check to use data[trailerPos] instead of data[xmpPos] inside the trailer search loop.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

findXmp() checks data[xmpPos] instead of data[trailerPos] in trailer search loop

2 participants