-
-
Notifications
You must be signed in to change notification settings - Fork 887
V3 Use EXIF byte order for EXIF encoded strings. #2944
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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..]);
Updated [SixLabors.ImageSharp](https://github.com/SixLabors/ImageSharp) from 3.1.7 to 3.1.11. <details> <summary>Release notes</summary> _Sourced from [SixLabors.ImageSharp's releases](https://github.com/SixLabors/ImageSharp/releases)._ ## 3.1.11 ## What's Changed * Backport V3 - GIF: Check for end of stream when reading comments. by @JimBobSquarePants in SixLabors/ImageSharp#2955 **Full Changelog**: SixLabors/ImageSharp@v3.1.10...v3.1.11 ## 3.1.10 ## What's Changed * V3: Remove ExifTagValue.InteroperabilityIndex by @JimBobSquarePants in SixLabors/ImageSharp#2939 * V3 TIFF : Allow additional and undefined extra samples by @JimBobSquarePants in SixLabors/ImageSharp#2942 * V3 Use EXIF byte order for EXIF encoded strings. by @JimBobSquarePants in SixLabors/ImageSharp#2944 * V3 Backport : Reduce the number of memory allocations in lossless WebP encoder by @JimBobSquarePants in SixLabors/ImageSharp#2947 **Full Changelog**: SixLabors/ImageSharp@v3.1.9...v3.1.10 ## 3.1.9 ## What's Changed * V3: Do not attempt to decode iDAT chunks when image is fully decoded. by @JimBobSquarePants in SixLabors/ImageSharp#2927 * V3 - Do not throw exception for non-required chunks. by @JimBobSquarePants in SixLabors/ImageSharp#2929 * V3: Do not encode WEBP images exceeding max dimensions by @JimBobSquarePants in SixLabors/ImageSharp#2931 **Full Changelog**: SixLabors/ImageSharp@v3.1.8...v3.1.9 ## 3.1.8 ## What's Changed * V3 : Fix GIF, PNG, and WEBP Edge Case Handling by @JimBobSquarePants in SixLabors/ImageSharp#2882 * V3 Nested sub ifds parsing fix by @JimBobSquarePants in SixLabors/ImageSharp#2913 * V3: Undo horizontal prediction for each tile row in case of tiled tiff's by @JimBobSquarePants in SixLabors/ImageSharp#2914 * V3 - Use BPP from Color Writer for Compressor by @JimBobSquarePants in SixLabors/ImageSharp#2915 **Full Changelog**: SixLabors/ImageSharp@v3.1.7...v3.1.8 Commits viewable in [compare view](SixLabors/ImageSharp@v3.1.7...v3.1.11). </details> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/HEJOK254/Discord-QuickEdit/network/alerts). </details> Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Prerequisites
Description
Fixes #2906
A backport of #2943 for V3.