coverity: remove dead code
Found with: CID 1521533 Unsigned compared against 0 (NO_EFFECT) Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
parent
03d34bee04
commit
b9d94e61fe
@ -383,8 +383,6 @@ void Image::printIFDStructure(BasicIo& io, std::ostream& out, Exiv2::PrintStruct
|
|||||||
if (allocate64 > io.size()) {
|
if (allocate64 > io.size()) {
|
||||||
throw Error(ErrorCode::kerInvalidMalloc);
|
throw Error(ErrorCode::kerInvalidMalloc);
|
||||||
}
|
}
|
||||||
// Overflow check
|
|
||||||
Internal::enforce(allocate64 <= std::numeric_limits<size_t>::max(), ErrorCode::kerCorruptedMetadata);
|
|
||||||
DataBuf buf(allocate64); // allocate a buffer
|
DataBuf buf(allocate64); // allocate a buffer
|
||||||
std::copy_n(dir.c_data(8), 4, buf.begin()); // copy dir[8:11] into buffer (short strings)
|
std::copy_n(dir.c_data(8), 4, buf.begin()); // copy dir[8:11] into buffer (short strings)
|
||||||
|
|
||||||
|
|||||||
@ -520,9 +520,6 @@ DataBuf PngChunk::readRawProfile(const DataBuf& text, bool iTXt) {
|
|||||||
while ('0' <= *sp && *sp <= '9') {
|
while ('0' <= *sp && *sp <= '9') {
|
||||||
// Compute the new length using unsigned long, so that we can check for overflow.
|
// Compute the new length using unsigned long, so that we can check for overflow.
|
||||||
const size_t newlength = (10 * length) + (*sp - '0');
|
const size_t newlength = (10 * length) + (*sp - '0');
|
||||||
if (newlength > std::numeric_limits<size_t>::max()) {
|
|
||||||
return {}; // Integer overflow.
|
|
||||||
}
|
|
||||||
length = newlength;
|
length = newlength;
|
||||||
sp++;
|
sp++;
|
||||||
if (sp == eot) {
|
if (sp == eot) {
|
||||||
|
|||||||
@ -874,8 +874,6 @@ DataBuf decodeBase64(const std::string& src) {
|
|||||||
const unsigned long destSize = (validSrcSize * 3) / 4;
|
const unsigned long destSize = (validSrcSize * 3) / 4;
|
||||||
|
|
||||||
// allocate dest buffer
|
// allocate dest buffer
|
||||||
if (destSize > LONG_MAX)
|
|
||||||
return {}; // avoid integer overflow
|
|
||||||
DataBuf dest(destSize);
|
DataBuf dest(destSize);
|
||||||
|
|
||||||
// decode
|
// decode
|
||||||
|
|||||||
@ -245,11 +245,6 @@ void RafImage::readMetadata() {
|
|||||||
|
|
||||||
Internal::enforce(Safe::add(jpg_img_off_u32, jpg_img_len_u32) <= io_->size(), ErrorCode::kerCorruptedMetadata);
|
Internal::enforce(Safe::add(jpg_img_off_u32, jpg_img_len_u32) <= io_->size(), ErrorCode::kerCorruptedMetadata);
|
||||||
|
|
||||||
#if LONG_MAX < UINT_MAX
|
|
||||||
Internal::enforce(jpg_img_off_u32 <= std::numeric_limits<uint32_t>::max(), ErrorCode::kerCorruptedMetadata);
|
|
||||||
Internal::enforce(jpg_img_len_u32 <= std::numeric_limits<uint32_t>::max(), ErrorCode::kerCorruptedMetadata);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
auto jpg_img_off = static_cast<long>(jpg_img_off_u32);
|
auto jpg_img_off = static_cast<long>(jpg_img_off_u32);
|
||||||
auto jpg_img_len = static_cast<long>(jpg_img_len_u32);
|
auto jpg_img_len = static_cast<long>(jpg_img_len_u32);
|
||||||
|
|
||||||
|
|||||||
@ -1456,7 +1456,7 @@ static const TagInfo* findTagInfo(uint16_t tag, IfdId group) {
|
|||||||
const TagInfo* result = nullptr;
|
const TagInfo* result = nullptr;
|
||||||
const TagInfo* tags = [=] {
|
const TagInfo* tags = [=] {
|
||||||
if (group == IfdId::gpsId)
|
if (group == IfdId::gpsId)
|
||||||
return group == IfdId::exifId ? Internal::exifTagList() : Internal::gpsTagList();
|
return Internal::gpsTagList();
|
||||||
return group == IfdId::exifId ? Internal::exifTagList() : nullptr;
|
return group == IfdId::exifId ? Internal::exifTagList() : nullptr;
|
||||||
}();
|
}();
|
||||||
if (tags) {
|
if (tags) {
|
||||||
|
|||||||
@ -977,7 +977,7 @@ std::ostream& TimeValue::write(std::ostream& os) const {
|
|||||||
int64_t TimeValue::toInt64(size_t /*n*/) const {
|
int64_t TimeValue::toInt64(size_t /*n*/) const {
|
||||||
// Returns number of seconds in the day in UTC.
|
// Returns number of seconds in the day in UTC.
|
||||||
auto result = static_cast<int64_t>(time_.hour - time_.tzHour) * 60 * 60;
|
auto result = static_cast<int64_t>(time_.hour - time_.tzHour) * 60 * 60;
|
||||||
result += (time_.minute - time_.tzMinute) * 60;
|
result += static_cast<int64_t>(time_.minute - time_.tzMinute) * 60;
|
||||||
result += time_.second;
|
result += time_.second;
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
result += 86400;
|
result += 86400;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user