[testsuite] Port all regression tests for github issues

This commit is contained in:
Dan Čermák 2018-02-02 00:40:01 +01:00
parent 3cbb031442
commit 3b01d5205a
26 changed files with 414 additions and 2 deletions

View File

@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
import system_tests
class TestCvePoC(system_tests.Case):
url = "https://github.com/Exiv2/exiv2/issues/49"
filename = "{data_path}/POC2"
commands = ["{exiv2} " + filename]
retval = [1]
stdout = [""]
stderr = [
"""{exiv2_exception_message} """ + filename + """:
{kerInvalidMalloc}
"""]

View File

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
import system_tests
class TestCvePoC(system_tests.Case):
url = "https://github.com/Exiv2/exiv2/issues/50"
filename = "{data_path}/POC3"
commands = ["{exiv2} " + filename]
stdout = [""]
stderr = ["""{exiv2_exception_message} """ + filename + """:
{kerInvalidMalloc}
"""]
retval = [1]

View File

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
import system_tests
class TestCvePoC(system_tests.Case):
url = "https://github.com/Exiv2/exiv2/issues/51"
filename = "{data_path}/POC4"
commands = ["{exiv2} " + filename]
stdout = [""]
stderr = ["""{exiv2_exception_message} """ + filename + """:
{kerInvalidMalloc}
"""]
retval = [1]

View File

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
import system_tests
class TestCvePoC(system_tests.Case):
url = "https://github.com/Exiv2/exiv2/issues/52"
filename = "{data_path}/POC5"
commands = ["{exiv2} " + filename]
stdout = [""]
stderr = ["""{exiv2_exception_message} """ + filename + """:
{kerInvalidMalloc}
"""]
retval = [1]

View File

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
import system_tests
class TestCvePoC(system_tests.Case):
url = "https://github.com/Exiv2/exiv2/issues/53"
filename = "{data_path}/POC6"
commands = ["{exiv2} " + filename]
stdout = [""]
stderr = ["""{exiv2_exception_message} """ + filename + """:
{kerInvalidMalloc}
"""]
retval = [1]

View File

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
import system_tests
class TestCvePoC(system_tests.Case):
url = "https://github.com/Exiv2/exiv2/issues/54"
filename = "{data_path}/POC7"
commands = ["{exiv2} " + filename]
stdout = [""]
stderr = ["""{exiv2_exception_message} """ + filename + """:
{kerInvalidMalloc}
"""]
retval = [1]

View File

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
import system_tests
class TestCvePoC(system_tests.Case):
url = "https://github.com/Exiv2/exiv2/issues/55"
filename = "{data_path}/POC8"
commands = ["{exiv2} " + filename]
stdout = [""]
stderr = ["""{exiv2_exception_message} """ + filename + """:
{kerInvalidMalloc}
"""]
retval = [1]

View File

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
import system_tests
class TestCvePoC(system_tests.Case):
url = "https://github.com/Exiv2/exiv2/issues/56"
filename = "{data_path}/POC9"
commands = ["{exiv2} " + filename]
stdout = [""""""]
stderr = ["""{exiv2_exception_message} """ + filename + """:
{kerInvalidMalloc}
"""]
retval = [1]

View File

@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
import system_tests
class TestCvePoC(system_tests.Case):
url = "https://github.com/Exiv2/exiv2/issues/57"
filename = "{data_path}/POC"
commands = ["{exiv2} " + filename]
stdout = [""]
stderr = ["""{kerInvalidTypeValue}: 0
{exiv2_exception_message} """ + filename + """:
{kerInvalidTypeValue}
"""]
retval = [1]

View File

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
import system_tests
class TestCvePoC(system_tests.Case):
url = "https://github.com/Exiv2/exiv2/issues/58"
filename = "{data_path}/POC11"
commands = ["{exiv2} " + filename]
stdout = [""]
stderr = ["""{exiv2_exception_message} """ + filename + """:
{kerInvalidMalloc}
"""]
retval = [1]

View File

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
import system_tests
class TestCvePoC(system_tests.Case):
url = "https://github.com/Exiv2/exiv2/issues/59"
filename = "{data_path}/POC12"
commands = ["{exiv2} " + filename]
stdout = [""]
stderr = ["""{exiv2_exception_message} """ + filename + """:
{kerInvalidMalloc}
"""]
retval = [1]

View File

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
import system_tests
class TestCvePoC(system_tests.Case):
url = "https://github.com/Exiv2/exiv2/issues/60"
filename = "{data_path}/POC13"
commands = ["{exiv2} " + filename]
stdout = [""]
stderr = ["""{exiv2_exception_message} """ + filename + """:
{kerInvalidMalloc}
"""]
retval = [1]

View File

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
import system_tests
class TestCvePoC(system_tests.Case):
url = "https://github.com/Exiv2/exiv2/issues/138"
filename = "{data_path}/007-heap-buffer-over"
commands = ["{exiv2} " + filename]
stdout = [""]
stderr = ["""{exiv2_exception_message} """ + filename + """:
{kerInvalidMalloc}
"""]
retval = [1]

View File

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
import system_tests
class TestCvePoC(system_tests.Case):
url = "https://github.com/Exiv2/exiv2/issues/74"
filename = "{data_path}/005-invalid-mem"
commands = ["{exiv2} " + filename]
stdout = [""]
stderr = ["""{exiv2_exception_message} """ + filename + """:
{kerCorruptedMetadata}
"""]
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)

View File

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
import system_tests
class TestCvePoC(system_tests.Case):
url = [
"https://github.com/Exiv2/exiv2/issues/139",
"https://bugzilla.redhat.com/show_bug.cgi?id=1494787"
]
filename = "{data_path}/009-stack-over"
commands = ["{exiv2} " + filename]
stdout = [""]
stderr = ["""{exiv2_exception_message} """ + filename + """:
{kerInvalidMalloc}
"""]
retval = [1]

View File

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
import system_tests
class TestCvePoC(system_tests.Case):
url = "https://github.com/Exiv2/exiv2/issues/75"
filename = "{data_path}/008-invalid-mem"
commands = ["{exiv2} " + filename]
stdout = [""]
stderr = ["""{exiv2_exception_message} """ + filename + """:
{kerCorruptedMetadata}
"""]
retval = [1]
def compare_stderr(self, i, command, got_stderr, expected_stderr):
"""
Only check that an exception is thrown for this file
ignore all the warnings on stderr on purpose.
"""
self.assertIn(expected_stderr, got_stderr)

View File

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
import system_tests
class TestCvePoC(system_tests.Case):
url = "https://github.com/Exiv2/exiv2/issues/132"
filename = "{data_path}/01-Null-exiv2-poc"
commands = ["{exiv2} " + filename]
stdout = [""]
stderr = ["""{exiv2_exception_message} """ + filename + """:
{kerInvalidMalloc}
"""]
retval = [1]

View File

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
import system_tests
class TestCvePoC(system_tests.Case):
url = "https://github.com/Exiv2/exiv2/issues/73"
filename = "{data_path}/02-Invalid-mem-def"
commands = ["{exiv2} " + filename]
stdout = [""]
stderr = ["""{exiv2_exception_message} """ + filename + """:
{kerCorruptedMetadata}
"""]
retval = [1]

View File

@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
import system_tests
class TestCvePoC(system_tests.Case):
url = "https://github.com/Exiv2/exiv2/issues/134"
filename = "{data_path}/004-heap-buffer-over"
commands = ["{exiv2} " + filename]
stdout = [""]
stderr = ["""{kerInvalidTypeValue}: 250
{exiv2_exception_message} """ + filename + """:
{kerInvalidTypeValue}
"""]
retval = [1]

View File

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
import system_tests
class TestCvePoC(system_tests.Case):
url = "https://github.com/Exiv2/exiv2/issues/140"
filename = "{data_path}/006-heap-buffer-over"
commands = ["{exiv2} " + filename]
stdout = [""]
stderr = ["""{exiv2_exception_message} """ + filename + """:
{kerInvalidMalloc}
"""]
retval = [1]

View File

@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
import system_tests
class TestCvePoC(system_tests.Case):
url = "https://github.com/Exiv2/exiv2/issues/188"
found_by = ["Wei You", "@youwei1988"]
filename = "{data_path}/poc_2017-12-12_issue188"
commands = ["{exiv2} " + filename]
stdout = [""]
stderr = ["""{exiv2_overflow_exception_message} """ + filename + """:
{addition_overflow_message}
"""]
retval = [1]

View File

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
import system_tests
class TestCvePoC(system_tests.Case):
url = "https://github.com/Exiv2/exiv2/issues/144"
filename = "{data_path}/POC1"
commands = ["{exiv2} " + filename]
stdout = [""]
stderr = ["""{exiv2_exception_message} """ + filename + """:
{kerInvalidMalloc}
"""]
retval = [1]

View File

@ -0,0 +1,23 @@
# -*- 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/159
"""
url = "https://github.com/Exiv2/exiv2/issues/159"
filename = "{data_path}/printStructure"
commands = ["{exiv2} " + filename]
stdout = [""]
stderr = ["""{exiv2_exception_message} """ + filename + """:
{kerCorruptedMetadata}
"""]
retval = [1]
# todo:
# class TestSecondPoC(system_tests.Case):

View File

@ -3,7 +3,7 @@
import system_tests
class decodeIHDRChunkOutOfBoundsRead(system_tests.Case):
class DecodeIHDRChunkOutOfBoundsRead(system_tests.Case):
url = "https://github.com/Exiv2/exiv2/issues/170"
@ -11,7 +11,7 @@ class decodeIHDRChunkOutOfBoundsRead(system_tests.Case):
commands = ["{exiv2} " + filename]
stdout = [""]
stderr = ["""{exiv2_exception_msg} """ + filename + """:
stderr = ["""{exiv2_exception_message} """ + filename + """:
{kerFailedToReadImageData}
"""]
retval = [1]

View File

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
import system_tests
class Sigma24_105mmRecognization(system_tests.Case):
url = "https://github.com/Exiv2/exiv2/issues/45"
filename = "{data_path}/exiv2-g45.exv"
commands = ["{exiv2} -pa --grep lens/i " + filename]
stdout = ["""Exif.CanonCs.LensType Short 1 Sigma 24-105mm F4 DG OS HSM [Art 013]
Exif.CanonCs.Lens Short 3 24.0 - 105.0 mm
Exif.CanonCf.LensAFStopButton Short 1 0
Exif.Canon.LensModel Ascii 74 24-105mm F4 DG OS HSM | Art 013
"""]
stderr = [""]
retval = [0]

View File

@ -18,6 +18,7 @@ tiff-test: ${ENV:exiv2_path}/tiff-test${ENV:binary_extension}
kerFailedToReadImageData: Failed to read image data
kerCorruptedMetadata: corrupted image metadata
kerInvalidMalloc: invalid memory allocation request
kerInvalidTypeValue: invalid type value detected in Image::printIFDStructure
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