Skip to content

Commit

Permalink
Strip XMP raw packet before decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
kmilos committed Mar 9, 2022
1 parent 89e66ff commit eb49d66
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 @@ -753,8 +753,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 eb49d66

Please sign in to comment.