Coverity scan fixes CID : 981999 (size overflow warning : typecasted) and 981993( divided by zeor warning : added check beore operation)
This commit is contained in:
parent
d3e0539bac
commit
cff1efe122
@ -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);
|
||||
|
||||
@ -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<T>(buf + i, byteOrder));
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user