Skip to content

Commit

Permalink
tests: manual fstring conversions
Browse files Browse the repository at this point in the history
Signed-off-by: Rosen Penev <[email protected]>
  • Loading branch information
neheb committed Dec 13, 2024
1 parent 0492d32 commit 9224251
Show file tree
Hide file tree
Showing 17 changed files with 35 additions and 49 deletions.
2 changes: 1 addition & 1 deletion tests/bugfixes/github/test_CVE_2017_1000126.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ 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]
commands = [f"$exiv2 {filename}"]
stdout = [""]
stderr = [
f"""$exiv2_exception_message {filename}:
Expand Down
16 changes: 7 additions & 9 deletions tests/bugfixes/github/test_CVE_2017_14859.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@ class TestCvePoC(metaclass=system_tests.CaseMeta):
commands = [f"$exiv2 {filename}"]
stdout = [""]
stderr = [
"""$exiv2_exception_message """
+ filename
+ ":\n"
+ (
"$kerFailedToReadImageData"
if system_tests.BT.Config.is_64bit
else "$kerCorruptedMetadata"
)
+ "\n"
f"""$exiv2_exception_message {filename}:
{(
"$kerFailedToReadImageData"
if system_tests.BT.Config.is_64bit
else "$kerCorruptedMetadata"
)}
"""
]
retval = [1]

Expand Down
6 changes: 2 additions & 4 deletions tests/bugfixes/github/test_CVE_2017_14860.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ class TestCvePoC(metaclass=system_tests.CaseMeta):
url = "https://github.com/Exiv2/exiv2/issues/73"

filename = "$data_path/003-heap-buffer-over"
commands = ["$exiv2 " + filename]
commands = [f"$exiv2 {filename}"]
stdout = [""]
stderr = [
"""$exiv2_exception_message """
+ filename
+ """:
f"""$exiv2_exception_message {filename}:
$kerCorruptedMetadata
"""
]
Expand Down
6 changes: 2 additions & 4 deletions tests/bugfixes/github/test_CVE_2017_14862.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@ 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 = [f"$exiv2 -q {filename}"]

if system_tests.BT.Config.is_64bit:
stderr = [""]
retval = [0]
else:
stderr = [
"""$exiv2_exception_message """
+ filename
+ """:
f"""$exiv2_exception_message {filename}:
$kerCorruptedMetadata
"""
]
Expand Down
16 changes: 7 additions & 9 deletions tests/bugfixes/github/test_CVE_2017_14864.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@ class TestCvePoC(metaclass=system_tests.CaseMeta):
commands = [f"$exiv2 -q {filename}"]
stdout = [""]
stderr = [
"""$exiv2_exception_message """
+ filename
+ ":\n"
+ (
"$kerFailedToReadImageData"
if system_tests.BT.Config.is_64bit
else "$kerCorruptedMetadata"
)
+ "\n"
f"""$exiv2_exception_message {filename}:
{(
"$kerFailedToReadImageData"
if system_tests.BT.Config.is_64bit
else "$kerCorruptedMetadata"
)}
"""
]
retval = [1]
6 changes: 2 additions & 4 deletions tests/bugfixes/github/test_CVE_2017_17669.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@ class TestCvePoC(metaclass=system_tests.CaseMeta):
url = "https://github.com/Exiv2/exiv2/issues/187"

filename = "$data_path/issue_187"
commands = ["$exiv2 " + filename]
commands = [f"$exiv2 {filename}"]
retval = [1]
stdout = [""]
stderr = [
"""$exiv2_exception_message """
+ filename
+ """:
f"""$exiv2_exception_message {filename}:
$kerFailedToReadImageData
"""
]
8 changes: 3 additions & 5 deletions tests/bugfixes/github/test_CVE_2017_17722.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@ 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]
commands = [f"$exiv2 {filename}"]
retval = [1]
stdout = [""]
stderr = [
"""$exiv2_exception_message """
+ filename
+ """:
$filename: $kerFileContainsUnknownImageType
f"""$exiv2_exception_message {filename}:
{filename}: $kerFileContainsUnknownImageType
"""
]
6 changes: 2 additions & 4 deletions tests/bugfixes/github/test_CVE_2017_17725.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ class TestCvePoC(metaclass=system_tests.CaseMeta):
found_by = ["Wei You", "@youwei1988"]

filename = "$data_path/poc_2017-12-12_issue188"
commands = ["$exiv2 " + filename]
commands = [f"$exiv2 {filename}"]
stdout = [""]
stderr = [
"""$exiv2_exception_message """
+ filename
+ """:
f"""$exiv2_exception_message {filename}:
$kerCorruptedMetadata
"""
]
Expand Down
2 changes: 1 addition & 1 deletion tests/bugfixes/github/test_CVE_2018_10999.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class TestCvePoC(metaclass=system_tests.CaseMeta):
url = "https://github.com/Exiv2/exiv2/issues/306"

filename = "$data_path/pocIssue306"
commands = ["$exiv2 -et " + filename]
commands = [f"$exiv2 -et {filename}"]
retval = [1]
stdout = [""]
stderr = [
Expand Down
2 changes: 1 addition & 1 deletion tests/bugfixes/github/test_CVE_2018_4868.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class TestCvePoC(metaclass=system_tests.CaseMeta):
found_by = ["afl", "topsecLab", "xcainiao"]

filename = "$data_path/exiv2-memorymmap-error"
commands = ["$exiv2 " + filename]
commands = [f"$exiv2 {filename}"]
stdout = [""]
stderr = [
"""$exiv2_exception_message """
Expand Down
2 changes: 1 addition & 1 deletion tests/bugfixes/github/test_issue_1011.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class Test_issue_1011(metaclass=CaseMeta):
filename = path("$data_path/Jp2Image_readMetadata_loop.poc")
commands = ["$exiv2 " + filename]
commands = [f"$exiv2 {filename}"]
stdout = [""]
stderr = [
"""$exiv2_exception_message """
Expand Down
2 changes: 1 addition & 1 deletion tests/bugfixes/github/test_issue_170.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class DecodeIHDRChunkOutOfBoundsRead(metaclass=system_tests.CaseMeta):

filename = "$data_path/issue_170_poc"

commands = ["$exiv2 " + filename]
commands = [f"$exiv2 {filename}"]
stdout = [""]
stderr = [
"""$exiv2_exception_message """
Expand Down
2 changes: 1 addition & 1 deletion tests/bugfixes/github/test_issue_246.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class TestFirstPoC(metaclass=system_tests.CaseMeta):
url = "https://github.com/Exiv2/exiv2/issues/246"

filename = "$data_path/1-string-format.jpg"
commands = ["$exiv2 -pS " + filename]
commands = [f"$exiv2 -pS {filename}"]
stdout = [
"""STRUCTURE OF JPEG FILE: """
+ filename
Expand Down
2 changes: 1 addition & 1 deletion tests/bugfixes/github/test_issue_253.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class TestFirstPoC(metaclass=system_tests.CaseMeta):
url = "https://github.com/Exiv2/exiv2/issues/253"

filename = "$data_path/3-stringformat-outofbound-read"
commands = ["$exiv2 " + filename]
commands = [f"$exiv2 {filename}"]
stdout = [""]
stderr = [
"""$exiv2_exception_message """
Expand Down
2 changes: 1 addition & 1 deletion tests/bugfixes/github/test_issue_426.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class DetectsWrongLengthOfImageResourceInPSDFile(metaclass=system_tests.CaseMeta
url = "https://github.com/Exiv2/exiv2/issues/426"

filename = system_tests.path("$data_path/h02.psd")
commands = ["$exiv2 " + filename]
commands = [f"$exiv2 {filename}"]
retval = [1]
stderr = [
"""$exiv2_exception_message """
Expand Down
2 changes: 1 addition & 1 deletion tests/bugfixes/github/test_issue_460.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class ThrowsWhenCRWImageIsMalformed(metaclass=system_tests.CaseMeta):
url = "https://github.com/Exiv2/exiv2/issues/460"

filename = system_tests.path("$data_path/issue_460")
commands = ["$exiv2 " + filename]
commands = [f"$exiv2 {filename}"]
retval = [1]
stderr = [
"""$exiv2_exception_message """
Expand Down
2 changes: 1 addition & 1 deletion tests/bugfixes/github/test_issue_511.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class ThrowsWhenIFDsAreMalformed(metaclass=system_tests.CaseMeta):
url = "https://github.com/Exiv2/exiv2/issues/511"

filename = system_tests.path("$data_path/pocIssue511")
commands = ["$exiv2 -pR " + filename]
commands = [f"$exiv2 -pR {filename}"]
retval = [1]
stdout = [
"""STRUCTURE OF TIFF FILE (II): """
Expand Down

0 comments on commit 9224251

Please sign in to comment.