Replace assertion with an error message.

(cherry picked from commit 4ec1768415ba015041a9bb28ab17c1ccf6a8c63e)
main
Kevin Backhouse 4 years ago committed by mergify-bot
parent d3e311fa62
commit e34e150f22

@ -999,9 +999,16 @@ namespace Exiv2 {
if (!mn_) { if (!mn_) {
return TiffEntryBase::doCount(); return TiffEntryBase::doCount();
} }
#ifndef SUPPRESS_WARNINGS
// Count of IFD makernote in tag Exif.Photo.MakerNote is the size of the // Count of IFD makernote in tag Exif.Photo.MakerNote is the size of the
// Makernote in bytes // Makernote in bytes
assert(tiffType() == ttUndefined || tiffType() == ttUnsignedByte || tiffType() == ttSignedByte); if (tiffType() != ttUndefined && tiffType() != ttUnsignedByte && tiffType() != ttSignedByte) {
EXV_ERROR << "Makernote entry 0x" << std::setw(4)
<< std::setfill('0') << std::hex << tag()
<< " has incorrect Exif (TIFF) type " << std::dec << tiffType()
<< ". (Expected signed or unsigned byte.)\n";
}
#endif
return mn_->size(); return mn_->size();
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
from system_tests import CaseMeta, path, check_no_ASAN_UBSAN_errors
class TiffMnEntryDoCountInvalidTiffType(metaclass=CaseMeta):
"""
Test for the bug described in:
https://github.com/Exiv2/exiv2/issues/1833
"""
url = "https://github.com/Exiv2/exiv2/issues/1833"
filename = path("$data_path/issue_1833_poc.jpg")
commands = ["$exiv2 -pS $filename"]
stderr = [""]
retval = [0]
compare_stdout = check_no_ASAN_UBSAN_errors
Loading…
Cancel
Save