V3 Use EXIF byte order for EXIF encoded strings. #2944
Merged
JimBobSquarePants merged 3 commits intorelease/3.1.xfrom Jun 12, 2025
Merged
V3 Use EXIF byte order for EXIF encoded strings. #2944JimBobSquarePants merged 3 commits intorelease/3.1.xfrom
JimBobSquarePants merged 3 commits intorelease/3.1.xfrom
Conversation
4 tasks
Contributor
There was a problem hiding this comment.
Pull Request Overview
This pull request backports changes to ensure that EXIF encoded strings are interpreted using the EXIF byte order. Key changes include:
- Addition of a new test case for Issue2906.
- Updates to ExifEncodedString and ExifEncodedStringHelpers to handle a ByteOrder parameter.
- Adjustments to ExifReader and ExifTag for improved endianness management.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Images/Input/Webp/issues/Issue2906.webp | Adds a new Git LFS pointer file for testing. |
| tests/ImageSharp.Tests/TestImages.cs | Registers the new test image constant. |
| tests/ImageSharp.Tests/Formats/WebP/WebpDecoderTests.cs | Introduces a new test verifying proper decoding for Issue2906. |
| src/ImageSharp/Metadata/Profiles/Exif/Values/ExifEncodedString.cs | Adds a ByteOrder overload for TrySetValue and defaults to LittleEndian in the parameterless override. |
| src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.cs | Updates equality operators to handle nullable values. |
| src/ImageSharp/Metadata/Profiles/Exif/ExifReader.cs | Refactors endianness handling, ensuring ByteOrder is set based on IsBigEndian. |
| src/ImageSharp/Metadata/Profiles/Exif/ExifEncodedStringHelpers.cs | Updates methods to accept and use ByteOrder, with BOM detection logic for Unicode. |
Comments suppressed due to low confidence (2)
src/ImageSharp/Metadata/Profiles/Exif/ExifEncodedStringHelpers.cs:105
- Consider parameterizing or deriving the ByteOrder for GetDataLength to reflect the actual EXIF byte order, rather than defaulting to LittleEndian.
(uint)GetEncoding(encodedString.Code, ByteOrder.LittleEndian).GetByteCount(encodedString.Text) + CharacterCodeBytesLength;
src/ImageSharp/Metadata/Profiles/Exif/ExifEncodedStringHelpers.cs:112
- Consider using the actual EXIF byte order for encoding the string in Write, instead of hardcoding LittleEndian, to ensure consistency with the rest of the EXIF handling.
int count = Write(GetEncoding(encodedString.Code, ByteOrder.LittleEndian), text, destination[CharacterCodeBytesLength..]);
This was referenced Jul 23, 2025
This was referenced Jul 30, 2025
This was referenced Nov 16, 2025
This was referenced Nov 23, 2025
This was referenced Dec 1, 2025
This was referenced Dec 10, 2025
This was referenced Dec 18, 2025
This was referenced Dec 29, 2025
This was referenced Jan 6, 2026
This was referenced Jan 15, 2026
This was referenced Feb 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prerequisites
Description
Fixes #2906
A backport of #2943 for V3.