-
Notifications
You must be signed in to change notification settings - Fork 282
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
Strip XMP raw packet before decoding #2133
Conversation
Is it possible to add a new test case with the image provided in #2126 ? |
0391f21
to
c68b05c
Compare
Can do once we're happy w/ the fix... |
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.
Three comments:
-
This feels in the wrong place. actions.cpp is in the exiv2 application. Shouldn't this code be in the library? Of is this code only used when reading sidecars?
-
What about `\n' ?
-
Are you certain only the XMLsdk can throw XMLsdk error messages.
Codecov Report
@@ Coverage Diff @@
## main #2133 +/- ##
==========================================
- Coverage 63.35% 63.35% -0.01%
==========================================
Files 97 97
Lines 19174 19176 +2
Branches 9712 9713 +1
==========================================
+ Hits 12148 12149 +1
Misses 4758 4758
- Partials 2268 2269 +1
Continue to review full report at Codecov.
|
The library already takes std::string as input to
The LF didn't create the problem, as I commented here. It really is the NUL terminator only.
Nope, haven't addressed this (yet). |
Actually @clanmills you might be right, could be an idea to sanitize this first thing in |
@kmilos You've understood my point. Trap this between Exiv2 and XMPsdk. It the case of OM.JPEG, JpegImage::readMetada() parses the JPEG to find the XMP "blob" and sends it to the XMPsdk. Every image handler (pngimage.cpp etc) uses the same strategy. Kev wanted |
I'm still not 100% satisfied w/ that approach: it only makes libexpat happy at the point of check(), but still passes the unsanitized buffer to the XMP toolkit (which luckily is not unhappy with it so far)... OTOH, checking this in every image handler at the point of xmlPacket_.assign() is cumbersome, might have to add yet another abstraction method for setting this... |
@kmilos. Can you circle back and discuss check_input() with @kevinbackhouse. Here are the goals that I see for this PR:
|
c68b05c
to
8eff659
Compare
Is the |
Yes. libexpat is not tolerating a trailing |
Ha, some tests that were failing before seem to pass now? Or throw a different error... Quite a few to update anyway. |
8eff659
to
888456c
Compare
888456c
to
eb49d66
Compare
Ok, ended up listening to gray hair @clanmills but a level above so we can pass the same data to both the libexpat validator and then the XMP SDK - this is less messy than touching all the image handlers... |
@piponazo Turns out we already had test files that exhibit this problem! |
Ah, Milos, you say the nicest things. At least I'm still gray and not white yet. Alison said "tell him you haven't got and old brain". Mind you, my hearing isn't so good, maybe she said "tell him you haven't got an old nag!". |
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.
Great work guys! 👏
Addresses XML parsing in #2126