Skip to content

Commit

Permalink
tests: github: format files
Browse files Browse the repository at this point in the history
Ran with ruff format

Signed-off-by: Rosen Penev <rosenp@gmail.com>
  • Loading branch information
neheb committed Dec 13, 2024
1 parent 55bfcd1 commit 0492d32
Show file tree
Hide file tree
Showing 208 changed files with 2,152 additions and 1,572 deletions.
7 changes: 4 additions & 3 deletions tests/bugfixes/github/test_CVE_2017_1000126.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@


class TestCvePoC(metaclass=system_tests.CaseMeta):

url = "https://github.com/Exiv2/exiv2/issues/175"

filename = "$data_path/cve_2017_1000126_stack-oob-read.webp"
commands = ["$exiv2 " + filename]
stdout = [""]
stderr = ["""$exiv2_exception_message """ + filename + """:
stderr = [
f"""$exiv2_exception_message {filename}:
$kerCorruptedMetadata
"""]
"""
]
retval = [1]
1 change: 0 additions & 1 deletion tests/bugfixes/github/test_CVE_2017_1000127.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class TestPoC(metaclass=system_tests.CaseMeta):

url = "https://github.com/Exiv2/exiv2/issues/176"

filename = "$data_path/heap-oob-write.tiff"
Expand Down
7 changes: 4 additions & 3 deletions tests/bugfixes/github/test_CVE_2017_11336.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@


class TestCvePoC(metaclass=system_tests.CaseMeta):

url = "https://github.com/Exiv2/exiv2/issues/49"

filename = "$data_path/POC2"
commands = ["$exiv2 $filename"]
retval = [0]
stdout = ["""File name : $filename
stdout = [
"""File name : $filename
File size : 60 Bytes
MIME type : image/tiff
Image size : 0 x 0
Expand Down Expand Up @@ -41,4 +41,5 @@ class TestCvePoC(metaclass=system_tests.CaseMeta):
"""Error: Directory Image, entry 0x0000 has invalid size 4294967295*8; skipping entry.
Error: Directory Image, entry 0x0000 has invalid size 1229524224*4; skipping entry.
Error: Directory Image, entry 0x0000 has invalid size 1229520896*8; skipping entry.
"""]
"""
]
1 change: 0 additions & 1 deletion tests/bugfixes/github/test_CVE_2017_11337.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class TestCvePoC(metaclass=system_tests.CaseMeta):

url = "https://github.com/Exiv2/exiv2/issues/50"

filename = "$data_path/POC3"
Expand Down
1 change: 0 additions & 1 deletion tests/bugfixes/github/test_CVE_2017_11338.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class TestCvePoC(metaclass=system_tests.CaseMeta):

url = "https://github.com/Exiv2/exiv2/issues/51"

filename = "$data_path/POC4"
Expand Down
7 changes: 4 additions & 3 deletions tests/bugfixes/github/test_CVE_2017_11339.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@


class TestCvePoC(metaclass=system_tests.CaseMeta):

url = "https://github.com/Exiv2/exiv2/issues/52"

filename = "$data_path/POC5"
commands = ["$exiv2 $filename"]
stdout = ["""File name : $filename
stdout = [
"""File name : $filename
File size : 60 Bytes
MIME type : image/x-olympus-orf
Image size : 0 x 0
Expand All @@ -34,7 +34,8 @@ class TestCvePoC(metaclass=system_tests.CaseMeta):
Copyright :
Exif comment :
"""]
"""
]
stderr = [
"""Error: Directory Image, entry 0xcf45 has invalid size 4294967292*4; skipping entry.
Error: Offset of directory Image, entry 0x8000 is out of bounds: Offset = 0x0012ff00; truncating the entry
Expand Down
7 changes: 4 additions & 3 deletions tests/bugfixes/github/test_CVE_2017_11340.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@


class TestCvePoC(metaclass=system_tests.CaseMeta):

url = "https://github.com/Exiv2/exiv2/issues/53"

filename = "$data_path/POC6"
commands = ["$exiv2 $filename"]
stdout = ["""File name : $filename
stdout = [
"""File name : $filename
File size : 60 Bytes
MIME type : image/x-olympus-orf
Image size : 0 x 0
Expand All @@ -34,7 +34,8 @@ class TestCvePoC(metaclass=system_tests.CaseMeta):
Copyright :
Exif comment :
"""]
"""
]
stderr = [
"""Error: Directory Image, entry 0x0000 has invalid size 4294967295*1; skipping entry.
Error: Offset of directory Image, entry 0x0000 is out of bounds: Offset = 0x7e000000; truncating the entry
Expand Down
1 change: 0 additions & 1 deletion tests/bugfixes/github/test_CVE_2017_11553.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class TestCvePoC(metaclass=system_tests.CaseMeta):

url = "https://github.com/Exiv2/exiv2/issues/54"

filename = "$data_path/POC7"
Expand Down
1 change: 0 additions & 1 deletion tests/bugfixes/github/test_CVE_2017_11591.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class TestCvePoC(metaclass=system_tests.CaseMeta):

url = "https://github.com/Exiv2/exiv2/issues/55"

filename = "$data_path/POC8"
Expand Down
1 change: 0 additions & 1 deletion tests/bugfixes/github/test_CVE_2017_11592.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class TestCvePoC(metaclass=system_tests.CaseMeta):

url = "https://github.com/Exiv2/exiv2/issues/56"

filename = "$data_path/POC9"
Expand Down
1 change: 0 additions & 1 deletion tests/bugfixes/github/test_CVE_2017_11683.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class TestCvePoC(metaclass=system_tests.CaseMeta):

url = "https://github.com/Exiv2/exiv2/issues/57"

filename = "$data_path/POC"
Expand Down
7 changes: 4 additions & 3 deletions tests/bugfixes/github/test_CVE_2017_12955.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class TestCvePoC(metaclass=system_tests.CaseMeta):

url = "https://github.com/Exiv2/exiv2/issues/58"

filename = "$data_path/POC11"
Expand All @@ -16,7 +15,8 @@ class TestCvePoC(metaclass=system_tests.CaseMeta):
Image size : 131345 x 65536
"""
]
stderr = ["""Error: Directory Image: Next pointer is out of bounds; ignored.
stderr = [
"""Error: Directory Image: Next pointer is out of bounds; ignored.
Error: Directory Image, entry 0x0000 has invalid size 3402235904*1; skipping entry.
Error: Directory Image, entry 0x014a has invalid size 4294967295*1; skipping entry.
Warning: Directory Image, entry 0x014a doesn't look like a sub-IFD.
Expand All @@ -25,5 +25,6 @@ class TestCvePoC(metaclass=system_tests.CaseMeta):
Warning: Directory Image, entry 0x0001 has unknown Exif (TIFF) type 0; setting type size 1.
Error: Directory Image, entry 0x0001 has invalid size 3401632458*1; skipping entry.
$filename: No Exif data found in the file
"""]
"""
]
retval = ["$no_exif_data_found_retval"]
1 change: 0 additions & 1 deletion tests/bugfixes/github/test_CVE_2017_12956.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class TestCvePoC(metaclass=system_tests.CaseMeta):

url = "https://github.com/Exiv2/exiv2/issues/59"

filename = "$data_path/POC12"
Expand Down
1 change: 0 additions & 1 deletion tests/bugfixes/github/test_CVE_2017_12957.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class TestCvePoC(metaclass=system_tests.CaseMeta):

url = "https://github.com/Exiv2/exiv2/issues/60"

filename = "$data_path/POC13"
Expand Down
1 change: 0 additions & 1 deletion tests/bugfixes/github/test_CVE_2017_14857.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class TestCvePoC(metaclass=system_tests.CaseMeta):

url = "https://github.com/Exiv2/exiv2/issues/76"

filename = "$data_path/010_bad_free"
Expand Down
1 change: 0 additions & 1 deletion tests/bugfixes/github/test_CVE_2017_14858.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class TestCvePoC(metaclass=system_tests.CaseMeta):

url = "https://github.com/Exiv2/exiv2/issues/138"

filename = "$data_path/007-heap-buffer-over"
Expand Down
18 changes: 13 additions & 5 deletions tests/bugfixes/github/test_CVE_2017_14859.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,26 @@

import system_tests

class TestCvePoC(metaclass=system_tests.CaseMeta):

class TestCvePoC(metaclass=system_tests.CaseMeta):
url = "https://github.com/Exiv2/exiv2/issues/74"

filename = "$data_path/005-invalid-mem"
commands = [f"$exiv2 {filename}"]
stdout = [""]
stderr = ["""$exiv2_exception_message """ + filename + ":\n" +
("$kerFailedToReadImageData" if system_tests.BT.Config.is_64bit else "$kerCorruptedMetadata") +
"\n"]
stderr = [
"""$exiv2_exception_message """
+ filename
+ ":\n"
+ (
"$kerFailedToReadImageData"
if system_tests.BT.Config.is_64bit
else "$kerCorruptedMetadata"
)
+ "\n"
]
retval = [1]

def compare_stderr(self, i, command, got_stderr, expected_stderr):
""" Only check that an exception is thrown """
"""Only check that an exception is thrown"""
self.assertIn(expected_stderr, got_stderr)
9 changes: 6 additions & 3 deletions tests/bugfixes/github/test_CVE_2017_14860.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@


class TestCvePoC(metaclass=system_tests.CaseMeta):

url = "https://github.com/Exiv2/exiv2/issues/73"

filename = "$data_path/003-heap-buffer-over"
commands = ["$exiv2 " + filename]
stdout = [""]
stderr = ["""$exiv2_exception_message """ + filename + """:
stderr = [
"""$exiv2_exception_message """
+ filename
+ """:
$kerCorruptedMetadata
"""]
"""
]
retval = [1]
6 changes: 3 additions & 3 deletions tests/bugfixes/github/test_CVE_2017_14861.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@


class TestCvePoC(metaclass=system_tests.CaseMeta):

url = [
"https://github.com/Exiv2/exiv2/issues/139",
"https://bugzilla.redhat.com/show_bug.cgi?id=1494787"
"https://bugzilla.redhat.com/show_bug.cgi?id=1494787",
]

filename = "$data_path/009-stack-over"
commands = ["$exiv2 $filename"]
stdout = ["""File name : $filename
stdout = [
"""File name : $filename
File size : 340 Bytes
MIME type : image/tiff
Image size : 0 x 0
Expand Down
11 changes: 7 additions & 4 deletions tests/bugfixes/github/test_CVE_2017_14862.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import system_tests
from system_tests import check_no_ASAN_UBSAN_errors

class TestCvePoC(metaclass=system_tests.CaseMeta):

class TestCvePoC(metaclass=system_tests.CaseMeta):
url = "https://github.com/Exiv2/exiv2/issues/75"

filename = "$data_path/008-invalid-mem"
Expand All @@ -14,10 +14,13 @@ class TestCvePoC(metaclass=system_tests.CaseMeta):
stderr = [""]
retval = [0]
else:
stderr = ["""$exiv2_exception_message """ + filename + """:
stderr = [
"""$exiv2_exception_message """
+ filename
+ """:
$kerCorruptedMetadata
"""]
"""
]
retval = [1]

compare_stdout = check_no_ASAN_UBSAN_errors

1 change: 0 additions & 1 deletion tests/bugfixes/github/test_CVE_2017_14863.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class TestCvePoC(metaclass=system_tests.CaseMeta):

url = "https://github.com/Exiv2/exiv2/issues/132"

filename = "$data_path/01-Null-exiv2-poc"
Expand Down
16 changes: 12 additions & 4 deletions tests/bugfixes/github/test_CVE_2017_14864.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,22 @@

import system_tests

class TestCvePoC(metaclass=system_tests.CaseMeta):

class TestCvePoC(metaclass=system_tests.CaseMeta):
url = "https://github.com/Exiv2/exiv2/issues/73"

filename = "$data_path/02-Invalid-mem-def"
commands = [f"$exiv2 -q {filename}"]
stdout = [""]
stderr = ["""$exiv2_exception_message """ + filename + ":\n" +
("$kerFailedToReadImageData" if system_tests.BT.Config.is_64bit else "$kerCorruptedMetadata") +
"\n"]
stderr = [
"""$exiv2_exception_message """
+ filename
+ ":\n"
+ (
"$kerFailedToReadImageData"
if system_tests.BT.Config.is_64bit
else "$kerCorruptedMetadata"
)
+ "\n"
]
retval = [1]
1 change: 0 additions & 1 deletion tests/bugfixes/github/test_CVE_2017_14865.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class TestCvePoC(metaclass=system_tests.CaseMeta):

url = "https://github.com/Exiv2/exiv2/issues/134"

filename = "$data_path/004-heap-buffer-over"
Expand Down
1 change: 0 additions & 1 deletion tests/bugfixes/github/test_CVE_2017_14866.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class TestCvePoC(metaclass=system_tests.CaseMeta):

url = "https://github.com/Exiv2/exiv2/issues/140"

filename = "$data_path/006-heap-buffer-over"
Expand Down
5 changes: 3 additions & 2 deletions tests/bugfixes/github/test_CVE_2017_17669.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@


class TestCvePoC(metaclass=system_tests.CaseMeta):

url = "https://github.com/Exiv2/exiv2/issues/187"

filename = "$data_path/issue_187"
commands = ["$exiv2 " + filename]
retval = [1]
stdout = [""]
stderr = [
"""$exiv2_exception_message """ + filename + """:
"""$exiv2_exception_message """
+ filename
+ """:
$kerFailedToReadImageData
"""
]
8 changes: 5 additions & 3 deletions tests/bugfixes/github/test_CVE_2017_17722.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@


class TestCvePoC(metaclass=system_tests.CaseMeta):

url = "https://github.com/Exiv2/exiv2/issues/208"

filename = "$data_path/2018-01-09-exiv2-crash-001.tiff"
commands = ["$exiv2 " + filename]
retval = [1]
stdout = [""]
stderr = [
"""$exiv2_exception_message """ + filename + """:
"""$exiv2_exception_message """
+ filename
+ """:
$filename: $kerFileContainsUnknownImageType
"""]
"""
]
Loading

0 comments on commit 0492d32

Please sign in to comment.