diff --git a/src/jp2image.cpp b/src/jp2image.cpp index c32e3e42..da2128a3 100644 --- a/src/jp2image.cpp +++ b/src/jp2image.cpp @@ -317,7 +317,7 @@ namespace Exiv2 std::cout << "Exiv2::Jp2Image::readMetadata: Xmp data found\n"; #endif - rawData.alloc(box.boxLength - (sizeof(box) + sizeof(uuid))); + rawData.alloc(box.boxLength - (u_int32_t)(sizeof(box) + sizeof(uuid))); bufRead = io_->read(rawData.pData_, rawData.size_); if (io_->error()) throw Error(14); if (bufRead != rawData.size_) throw Error(20); diff --git a/src/value.hpp b/src/value.hpp index 59a72f9f..c3eb459f 100644 --- a/src/value.hpp +++ b/src/value.hpp @@ -1550,7 +1550,8 @@ namespace Exiv2 { { value_.clear(); long ts = TypeInfo::typeSize(typeId()); - if (len % ts != 0) len = (len / ts) * ts; + if (ts != 0) + if (len % ts != 0) len = (len / ts) * ts; for (long i = 0; i < len; i += ts) { value_.push_back(getValue(buf + i, byteOrder)); }