Skip to content

Commit

Permalink
Strip XMP raw packet before decoding (#2139)
Browse files Browse the repository at this point in the history
(cherry picked from commit eb49d66)
  • Loading branch information
kmilos authored Mar 10, 2022
1 parent d70e575 commit 44ef6ae
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/xmp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -765,8 +765,12 @@ namespace Exiv2 {
return 2;
}

XMLValidator::check(xmpPacket.data(), xmpPacket.size());
SXMPMeta meta(xmpPacket.data(), static_cast<XMP_StringLen>(xmpPacket.size()));
// Make sure the unterminated substring is used
size_t len = xmpPacket.size();
while (len > 0 && 0 == xmpPacket[len - 1]) --len;

XMLValidator::check(xmpPacket.data(), len);
SXMPMeta meta(xmpPacket.data(), static_cast<XMP_StringLen>(len));
SXMPIterator iter(meta);
std::string schemaNs, propPath, propValue;
XMP_OptionBits opt = 0;
Expand Down

0 comments on commit 44ef6ae

Please sign in to comment.