Replace assertion with an error message.
(cherry picked from commit 4ec1768415ba015041a9bb28ab17c1ccf6a8c63e)
This commit is contained in:
parent
d3e311fa62
commit
e34e150f22
@ -999,9 +999,16 @@ namespace Exiv2 {
|
||||
if (!mn_) {
|
||||
return TiffEntryBase::doCount();
|
||||
}
|
||||
#ifndef SUPPRESS_WARNINGS
|
||||
// Count of IFD makernote in tag Exif.Photo.MakerNote is the size of the
|
||||
// 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();
|
||||
}
|
||||
|
||||
|
||||
BIN
test/data/issue_1833_poc.jpg
Normal file
BIN
test/data/issue_1833_poc.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 32 KiB |
17
tests/bugfixes/github/test_issue_1833.py
Normal file
17
tests/bugfixes/github/test_issue_1833.py
Normal file
@ -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…
Reference in New Issue
Block a user