diff --git a/test/data/10-printStructure-outbound-read-2 b/test/data/10-printStructure-outbound-read-2 new file mode 100644 index 00000000..f0502caf Binary files /dev/null and b/test/data/10-printStructure-outbound-read-2 differ diff --git a/test/data/9-printStructure-outbound-read-1 b/test/data/9-printStructure-outbound-read-1 new file mode 100644 index 00000000..126928a4 Binary files /dev/null and b/test/data/9-printStructure-outbound-read-1 differ diff --git a/test/data/exiv2_0-26_exiv2_uncontrolled-recursion_printIFDStructure.tif b/test/data/exiv2_0-26_exiv2_uncontrolled-recursion_printIFDStructure.tif new file mode 100644 index 00000000..9e50cf97 Binary files /dev/null and b/test/data/exiv2_0-26_exiv2_uncontrolled-recursion_printIFDStructure.tif differ diff --git a/test/data/printStructure2 b/test/data/printStructure2 new file mode 100644 index 00000000..97ee450e Binary files /dev/null and b/test/data/printStructure2 differ diff --git a/tests/bugfixes/github/test_issue_159.py b/tests/bugfixes/github/test_issue_159.py index 72532550..ad9615bc 100644 --- a/tests/bugfixes/github/test_issue_159.py +++ b/tests/bugfixes/github/test_issue_159.py @@ -5,47 +5,23 @@ import system_tests class TestFirstPoC(metaclass=system_tests.CaseMeta): """ - Regression test for the first bug described in: + Regression test for the two bugs described in: https://github.com/Exiv2/exiv2/issues/159 + + We do not actually check the output of these files, we only check that we + don't get a crash (the metadata are bogus anyway, so no point in checking). """ url = "https://github.com/Exiv2/exiv2/issues/159" - filename = "$data_path/printStructure" - commands = ["$exiv2 " + filename] - stdout = [ - """File name : $filename -File size : 12357 Bytes -MIME type : image/tiff -Image size : 0 x 0 -Camera make : -Camera model : -Image timestamp : -Image number : -Exposure time : -Aperture : -Exposure bias : -Flash : -Flash bias : -Focal length : -Subject distance: -ISO speed : -Exposure mode : -Metering mode : -Macro mode : -Image quality : -Exif Resolution : -White balance : -Thumbnail : None -Copyright : -Exif comment : - -""" + filename = [ + system_tests.path("$data_path/printStructure"), + system_tests.path("$data_path/printStructure2") + ] + commands = [ + "$exiv2 " + filename[0], + "$exiv2 -pS " + filename[1], ] - stderr = [""] - retval = [0] + retval = [0, 1] compare_stderr = system_tests.check_no_ASAN_UBSAN_errors - - -# todo: -# class TestSecondPoC(system_tests.Case): + compare_stdout = system_tests.check_no_ASAN_UBSAN_errors diff --git a/tests/bugfixes/github/test_issue_216.py b/tests/bugfixes/github/test_issue_216.py new file mode 100644 index 00000000..7d7f29a0 --- /dev/null +++ b/tests/bugfixes/github/test_issue_216.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +import system_tests + + +class UncontrolledRecursion(metaclass=system_tests.CaseMeta): + url = "https://github.com/Exiv2/exiv2/issues/216" + + filename = system_tests.path( + "$data_path/" + "exiv2_0-26_exiv2_uncontrolled-recursion_printIFDStructure.tif" + ) + + commands = ["$exiv2 -pR $filename"] + retval = [1] + stdout = [ + """STRUCTURE OF TIFF FILE (MM): $filename + address | tag | type | count | offset | value + 10 | 0x0100 ImageWidth | SHORT | 1 | | 1 + 22 | 0x0103 Compression | SHORT | 0 | | + 34 | 000000 GPSVersionID | BYTE | 0 | | """ + ] + + compare_stderr = system_tests.check_no_ASAN_UBSAN_errors diff --git a/tests/bugfixes/github/test_issue_263.py b/tests/bugfixes/github/test_issue_263.py new file mode 100644 index 00000000..3f6799a9 --- /dev/null +++ b/tests/bugfixes/github/test_issue_263.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- + +import system_tests + + +class OutOfBoundsReadInPrintStructure(metaclass=system_tests.CaseMeta): + + url = "https://github.com/Exiv2/exiv2/issues/263" + + filenames = [ + system_tests.path("$data_path/9-printStructure-outbound-read-1"), + system_tests.path("$data_path/10-printStructure-outbound-read-2") + ] + + commands = ["$exiv2 -pR " + fname for fname in filenames] + + retval = [1] * 2 + + compare_stderr = system_tests.check_no_ASAN_UBSAN_errors + compare_stdout = system_tests.check_no_ASAN_UBSAN_errors