From 8eca055058a15ecc42b45550d19c1561b065aa89 Mon Sep 17 00:00:00 2001 From: Luis Diaz Mas Date: Fri, 25 May 2018 22:29:20 +0200 Subject: [PATCH] Add POC + regression test. Note that we override here the method check_no_ASAN_UBSAN_errors to also analyze the last two lines of got_stderr. --- test/data/pocIssue283.jpg | Bin 0 -> 2072 bytes tests/bugfixes/github/test_issue_283.py | 31 ++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 test/data/pocIssue283.jpg create mode 100644 tests/bugfixes/github/test_issue_283.py diff --git a/test/data/pocIssue283.jpg b/test/data/pocIssue283.jpg new file mode 100644 index 0000000000000000000000000000000000000000..88b08d4992fdf442cf5ab51433eb81d9bacb4880 GIT binary patch literal 2072 zcmeHHIS#@=473wKNhnZ6!3&TmmxedM1NaXmU*!)7nAz;%L@6jhN|BWkW+!8Nyz+9n zT%{6`t!%Uu1#(y#aOJqI6Yq?sRW#pp?yd(tb|n zcrqS(=AqN0Mg*Jhs>}ao13C5#4P)bSe#6&p6*)=H5c|#Yr{vs%zX9j47t*pb^%N1k zrq$6f04Ct{Z49Ul9ut7Gl0HUxlo@)k8k=&IANaTWKjJ)%tya>)1iRR2V$qo$5|24J@o#*R)@M_{ GIDrrQzfoNP literal 0 HcmV?d00001 diff --git a/tests/bugfixes/github/test_issue_283.py b/tests/bugfixes/github/test_issue_283.py new file mode 100644 index 00000000..fc9df793 --- /dev/null +++ b/tests/bugfixes/github/test_issue_283.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- + +import system_tests +import os.path + +class TestFirstPoC(metaclass=system_tests.CaseMeta): + """ + Regression test for the bug described in: + https://github.com/Exiv2/exiv2/issues/283 + """ + url = "https://github.com/Exiv2/exiv2/issues/283" + + def check_no_ASAN_UBSAN_errors(self, i, command, got_stderr, expected_stderr): + """ Override of system_tests.check_no_ASAN_UBSAN_errors for this particular test case. + + Here we want to also check that the two last lines of got_stderr have the expected_stderr + """ + + system_tests.check_no_ASAN_UBSAN_errors(self, i, command, got_stderr, expected_stderr) + self.assertListEqual(expected_stderr.splitlines(), got_stderr.splitlines()[-2:]) + + filename = os.path.join("$data_path", "pocIssue283.jpg") + commands = ["$exiv2 $filename"] + stdout = [""] + stderr = [ + """$exiv2_exception_message """ + filename + """: +$kerCorruptedMetadata +"""] + compare_stderr = check_no_ASAN_UBSAN_errors + retval = [1] +