Skip to content

Commit

Permalink
fix(png): Write out proper tiff header version in png EXIF blobs (#3984)
Browse files Browse the repository at this point in the history
When writing out EXIF headers in PNG files, the `tiff_version` field
wasn't handling endianness properly.

This lead to some tools like `exiv2` refusing to process the file at
all[1]

[1] Exiv2/exiv2#2745

---------

Signed-off-by: Jesse Yurkovich <jesse.y@gmail.com>
  • Loading branch information
jessey-git committed Sep 13, 2023
1 parent 069e1d9 commit c1d8fe6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/libOpenImageIO/exif.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1302,6 +1302,8 @@ encode_exif(const ImageSpec& spec, std::vector<char>& blob,
TIFFHeader head;
head.tiff_magic = (endianreq == endian::little) ? 0x4949 : 0x4d4d;
head.tiff_version = 42;
if (endianreq != endian::native)
swap_endian(&head.tiff_version);
// N.B. need to swap_endian head.tiff_diroff below, once we know the sizes
append(blob, head);

Expand Down

0 comments on commit c1d8fe6

Please sign in to comment.