Skip to content

Fix IndexError on tags with empty values list - #258

Open
devmaiter wants to merge 1 commit into
ianare:masterfrom
devmaiter:fix-254-empty-makernote-values
Open

Fix IndexError on tags with empty values list#258
devmaiter wants to merge 1 commit into
ianare:masterfrom
devmaiter:fix-254-empty-makernote-values

Conversation

@devmaiter

Copy link
Copy Markdown

Fixes #254

When a tag declares a single value (count == 1) but its data cannot be read — e.g. a truncated or corrupted file — the decoded values list is empty, and _get_printable_for_field raised an IndexError on values[0], aborting processing of the whole file.

This falls back to an empty printable string in that case, so the remaining tags are still returned.

Includes a minimal sample image (86 bytes, crafted from the DJI M3E case reported in the issue) and a regression test asserting the file processes without error and the affected tag decodes to an empty printable.

A tag declaring a single non-ASCII value whose data cannot be read
(e.g. truncated or corrupted file) leaves the decoded values list
empty, and building the printable string crashed with IndexError.
Seen in the wild on DJI M3E MakerNote tags.

Guard the zero-index access and add a minimal synthetic sample
image reproducing the DJI MakerNote case, with a regression test.
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.

IndexError in ExifHeader._get_printable_for_field on empty MakerNote values list (DJI M3E)

1 participant