Skip to content

Keep an undecoded maker note's pointer past the image valid on a length-changing edit #166

Backlog

Description

@decriptor

Problem

After #153, a maker note that the editor can't decode (#164) may still hold a pointer to bytes after the JPEG EOI or the PNG IEND. A length-changing edit moves those bytes, as exiftool does, so the pointer then names different bytes. #153 accepts this to match exiftool. No real file in the test corpus has an undecoded note with such a pointer, apart from the Sony files covered by #163.

The repro is the input of Comment_OfAJpegWithAnUnlocatedNoteAndATrailer_IsSaved.

Proposed solution

Once #164 decodes the layout, the pointer is rewritten by #163's delta. For notes that still can't be decoded, consider refusing a length-changing edit when there are bytes after the image. Notes that carry their own TIFF header use note-relative offsets and can't name the trailer, so they need no refusal.

Context

This is a follow-up to #153 and part of #111. It depends on #163 and #164.

Activity

  1. added
    enhancement
    on Nov 29, 2026
  2. changed the title [-]Refuse an edit that moves bytes after the image that an unread maker note names[/-] [+]Keep an undecoded maker note's pointer past the image valid on a length-changing edit[/+] on Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions