-
-
Notifications
You must be signed in to change notification settings - Fork 107
fix: Remove Exif with non-fatal errors from images #7280
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
base: main
Are you sure you want to change the base?
Conversation
15ed531
to
966cd48
Compare
let exif = exif::Reader::new() | ||
.continue_on_error(true) | ||
.read_from_container(&mut bufreader) | ||
.or_else(|e| e.distill_partial_result(|_errors| {})) |
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.
would it make sense to log something in this case?
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.
We only use the orientation field from Exif, so errors here are probably irrelevant, but we can log them if we pass Context
to this function, i'm just unsure it's worth doing that
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.
what is the change in this file?
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.
I added a comment to test_recode_image_1()
, i corrupted Exif in this file to test that it's still detected and removed by recoding the file. I could add another file instead, but we already have several JPEG test files, others contain Exif without invalid fields, so parsing correct Exif is still covered by other tests
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.
I'd at least rename this file to have "corrupted_exif" or so on the name.
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.
And I think it's better to add a new test for this without modifying existing one with no broken exif.
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.
Finally decided to add another test using another file not to affect existing tests
966cd48
to
67360bd
Compare
NB: This still doesn't help with detecting Exif in PNGs unfortunately.
67360bd
to
a5829cd
Compare
No description provided.