Skip to content

Commit

Permalink
Don't crash if s > size.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinbackhouse committed Jun 23, 2021
1 parent cdda410 commit 0c17eb3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/crwimage_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1246,9 +1246,10 @@ namespace Exiv2 {
for (ExifData::const_iterator i = b; i != e; ++i) {
if (i->ifdId() != ifdId) continue;
const uint16_t s = i->tag()*2 + static_cast<uint16_t>(i->size());
assert(s <= size);
if (len < s) len = s;
i->copy(buf.pData_ + i->tag()*2, byteOrder);
if (s <= size) {
if (len < s) len = s;
i->copy(buf.pData_ + i->tag()*2, byteOrder);
}
}
// Round the size to make it even.
buf.size_ = len + len%2;
Expand Down

0 comments on commit 0c17eb3

Please sign in to comment.