From 61e0c1f176d24191d682b087d10e7a52c2f937a4 Mon Sep 17 00:00:00 2001 From: Kevin Backhouse Date: Sat, 25 Feb 2023 22:49:43 +0000 Subject: [PATCH 1/2] Fix test failures on 32-bit platforms. --- tests/bugfixes/github/test_CVE_2017_14859.py | 5 ----- tests/bugfixes/github/test_CVE_2017_14862.py | 7 +++---- tests/bugfixes/github/test_CVE_2017_14864.py | 9 ++++----- tests/bugfixes/github/test_CVE_2018_12265.py | 19 +++++++++---------- 4 files changed, 16 insertions(+), 24 deletions(-) diff --git a/tests/bugfixes/github/test_CVE_2017_14859.py b/tests/bugfixes/github/test_CVE_2017_14859.py index 01c10df175..bc7658c2b9 100644 --- a/tests/bugfixes/github/test_CVE_2017_14859.py +++ b/tests/bugfixes/github/test_CVE_2017_14859.py @@ -2,17 +2,12 @@ import system_tests - class TestCvePoC(metaclass=system_tests.CaseMeta): url = "https://github.com/Exiv2/exiv2/issues/74" filename = "$data_path/005-invalid-mem" commands = ["$exiv2 " + filename] - stdout = [""] - stderr = ["""$exiv2_exception_message """ + filename + """: -$kerFailedToReadImageData -"""] retval = [1] def compare_stderr(self, i, command, got_stderr, expected_stderr): diff --git a/tests/bugfixes/github/test_CVE_2017_14862.py b/tests/bugfixes/github/test_CVE_2017_14862.py index 7b065cde2b..e3b924c011 100644 --- a/tests/bugfixes/github/test_CVE_2017_14862.py +++ b/tests/bugfixes/github/test_CVE_2017_14862.py @@ -8,10 +8,9 @@ class TestCvePoC(metaclass=system_tests.CaseMeta): url = "https://github.com/Exiv2/exiv2/issues/75" filename = "$data_path/008-invalid-mem" - commands = ["$exiv2 -q " + filename] + commands = ["$exiv2 -q -Y 2000 ad " + filename] - stderr = [""] - retval = [0] + retval = [1] compare_stdout = check_no_ASAN_UBSAN_errors - + compare_stderr = check_no_ASAN_UBSAN_errors diff --git a/tests/bugfixes/github/test_CVE_2017_14864.py b/tests/bugfixes/github/test_CVE_2017_14864.py index 15e88ef24a..50d4989d55 100644 --- a/tests/bugfixes/github/test_CVE_2017_14864.py +++ b/tests/bugfixes/github/test_CVE_2017_14864.py @@ -2,15 +2,14 @@ import system_tests - class TestCvePoC(metaclass=system_tests.CaseMeta): url = "https://github.com/Exiv2/exiv2/issues/73" filename = "$data_path/02-Invalid-mem-def" commands = ["$exiv2 -q " + filename] - stdout = [""] - stderr = ["""$exiv2_exception_message """ + filename + """: -$kerFailedToReadImageData -"""] retval = [1] + + def compare_stderr(self, i, command, got_stderr, expected_stderr): + """ Only check that an exception is thrown """ + self.assertIn(expected_stderr, got_stderr) diff --git a/tests/bugfixes/github/test_CVE_2018_12265.py b/tests/bugfixes/github/test_CVE_2018_12265.py index 735e67ceaa..1003c04d88 100644 --- a/tests/bugfixes/github/test_CVE_2018_12265.py +++ b/tests/bugfixes/github/test_CVE_2018_12265.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import system_tests - +from system_tests import check_no_ASAN_UBSAN_errors class AdditionOverflowInLoaderExifJpeg(metaclass=system_tests.CaseMeta): """ @@ -11,12 +11,11 @@ class AdditionOverflowInLoaderExifJpeg(metaclass=system_tests.CaseMeta): https://cve.mitre.org/cgi-bin/cvename.cgi?name=2018-12265 """ filename = system_tests.path("$data_path/1-out-of-read-Poc") - commands = ["$exiv2 -ep $filename"] - stdout = [""] - stderr = [ - """Error: Upper boundary of data for directory Image, entry 0x00fe is out of bounds: Offset = 0x0000002a, size = 64, exceeds buffer size by 22 Bytes; truncating the entry -Warning: Directory Image, entry 0x0201: Strip 0 is outside of the data area; ignored. -Warning: Directory Image, entry 0x0201: Strip 7 is outside of the data area; ignored. -""" - ] - retval = [0] + commands = ["$exiv2 -pS $filename"] + retval = [1] + + compare_stdout = check_no_ASAN_UBSAN_errors + + def compare_stderr(self, i, command, got_stderr, expected_stderr): + """ Only check that an exception is thrown """ + self.assertIn(expected_stderr, got_stderr) From d29acfe6fb911aecefe3a22af459062a478d0f1a Mon Sep 17 00:00:00 2001 From: Kevin Backhouse Date: Sun, 26 Feb 2023 12:16:13 +0000 Subject: [PATCH 2/2] Run tests on x86 --- .github/workflows/on_PR_windows_matrix.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/on_PR_windows_matrix.yml b/.github/workflows/on_PR_windows_matrix.yml index 4a905a0f2a..3c8f40a1e1 100644 --- a/.github/workflows/on_PR_windows_matrix.yml +++ b/.github/workflows/on_PR_windows_matrix.yml @@ -86,7 +86,6 @@ jobs: cmake --install build - name: Test - if: ${{matrix.platform == 'x64'}} run: | ctest --test-dir build --output-on-failure