diff --git a/src/tiffcomposite_int.cpp b/src/tiffcomposite_int.cpp index 8890ec47c8..a2694b4328 100644 --- a/src/tiffcomposite_int.cpp +++ b/src/tiffcomposite_int.cpp @@ -1545,7 +1545,11 @@ namespace Exiv2 { for (auto&& component : components_) { if (component->tag() == 0x014a) { // Hack: delay writing of sub-IFD image data to get the order correct - assert(pSubIfd == 0); +#ifndef SUPPRESS_WARNINGS + if (pSubIfd != 0) { + EXV_ERROR << "Multiple sub-IFD image data tags found\n"; + } +#endif pSubIfd = component; continue; } diff --git a/test/data/issue_1847_poc.jpg b/test/data/issue_1847_poc.jpg new file mode 100644 index 0000000000..08efb84d8d Binary files /dev/null and b/test/data/issue_1847_poc.jpg differ diff --git a/tests/bugfixes/github/test_issue_1847.py b/tests/bugfixes/github/test_issue_1847.py new file mode 100644 index 0000000000..b742a90c98 --- /dev/null +++ b/tests/bugfixes/github/test_issue_1847.py @@ -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/1847 + """ + url = "https://github.com/Exiv2/exiv2/issues/1847" + + filename = path("$data_path/issue_1847_poc.jpg") + commands = ["$exiv2 -pS $filename"] + stderr = [""] + retval = [0] + + compare_stdout = check_no_ASAN_UBSAN_errors