-
-
Notifications
You must be signed in to change notification settings - Fork 868
Fixed string exif value corner case exception #2088
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
@JimBobSquarePants can you please advise where should I place the image from this issue? |
@br3aker I think adding yet another entry to BaselineTestJpegs or ProgressiveTestJpegs is good enough, we have a bunch of Exif regression cases there already. |
Yep, just add it to the collection there |
Problem is that this image decodes correctly, it throws on encoding during writing exif profile. |
It’s cool, we did the same here. |
Done, hope I got your idea right. |
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.
Looks perfect. Thanks 👍
Prerequisites
Description
Closes #2087.
Given image from linked issue contains empty user comment tag which is written last. Allocated buffer is passed as
Span
which is sliced during different exif values rendering to the given buffer. This exact situation led to copying zero bytes to zero-length span aaaaand looks like .net treats empty spans with valid memory pointer as null pointer thus mentionedArgumentNullException
.Fix is fairly simple: use spans instead of working with raw pointers without any fixed statements (love this performance side effect) and unsafe stuff,
Encoding.GetBytes(ReadOnlySpan, Span)
respects empty spans.P.S.Waiting for issue image usage approval from the issue author.