From 08aa27ae37b4777b5dc144a340f483233fc29e7e Mon Sep 17 00:00:00 2001 From: Luis Diaz Mas Date: Sun, 1 Apr 2018 08:27:23 +0200 Subject: [PATCH] Add reproducers for #253 and #246 --- test/data/1-string-format.jpg | Bin 0 -> 65 bytes test/data/3-stringformat-outofbound-read | Bin 0 -> 52 bytes tests/bugfixes/github/test_issue_246.py | 25 +++++++++++++++++++++++ tests/bugfixes/github/test_issue_253.py | 18 ++++++++++++++++ tests/suite.conf | 2 ++ 5 files changed, 45 insertions(+) create mode 100644 test/data/1-string-format.jpg create mode 100644 test/data/3-stringformat-outofbound-read create mode 100644 tests/bugfixes/github/test_issue_246.py create mode 100644 tests/bugfixes/github/test_issue_253.py diff --git a/test/data/1-string-format.jpg b/test/data/1-string-format.jpg new file mode 100644 index 0000000000000000000000000000000000000000..dd6a5bbdeec84803a7576bee510a547d6d181986 GIT binary patch literal 65 zcmex=%7K1Lq_zu!s&&1OQ962*m&Z literal 0 HcmV?d00001 diff --git a/tests/bugfixes/github/test_issue_246.py b/tests/bugfixes/github/test_issue_246.py new file mode 100644 index 00000000..02eb908b --- /dev/null +++ b/tests/bugfixes/github/test_issue_246.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- + +import system_tests + +class TestFirstPoC(system_tests.Case): + """ + Regression test for the first bug described in: + https://github.com/Exiv2/exiv2/issues/246 + """ + url = "https://github.com/Exiv2/exiv2/issues/246" + + filename = "{data_path}/1-string-format.jpg" + commands = ["{exiv2} -pS " + filename] + stdout = [ + """STRUCTURE OF JPEG FILE: """ + filename + """ + address | marker | length | data + 0 | 0xffd8 SOI + 2 | 0xffe1 APP1 | 60 | Exif..II*.....0.i...........0000 +"""] + + + stderr = ["""{exiv2_exception_message} """ + filename + """: +{kerNoImageInInputData} +"""] + retval = [1] diff --git a/tests/bugfixes/github/test_issue_253.py b/tests/bugfixes/github/test_issue_253.py new file mode 100644 index 00000000..d0aad448 --- /dev/null +++ b/tests/bugfixes/github/test_issue_253.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +import system_tests + +class TestFirstPoC(system_tests.Case): + """ + Regression test for the first bug described in: + https://github.com/Exiv2/exiv2/issues/253 + """ + url = "https://github.com/Exiv2/exiv2/issues/253" + + filename = "{data_path}/3-stringformat-outofbound-read" + commands = ["{exiv2} " + filename] + stdout = [""] + stderr = ["""{exiv2_exception_message} """ + filename + """: +{kerNotAJpeg} +"""] + retval = [1] diff --git a/tests/suite.conf b/tests/suite.conf index a1795c00..e15b4724 100644 --- a/tests/suite.conf +++ b/tests/suite.conf @@ -19,6 +19,8 @@ kerFailedToReadImageData: Failed to read image data kerCorruptedMetadata: corrupted image metadata kerInvalidMalloc: invalid memory allocation request kerInvalidTypeValue: invalid type value detected in Image::printIFDStructure +kerNotAJpeg : This does not look like a JPEG image +kerNoImageInInputData: Input data does not contain a valid image addition_overflow_message: Overflow in addition exiv2_exception_message: Exiv2 exception in print action for file exiv2_overflow_exception_message: std::overflow_error exception in print action for file