Skip to content

Commit

Permalink
Add reproducer for #263 to the test suite.
Browse files Browse the repository at this point in the history
This fixes #263
  • Loading branch information
D4N committed Sep 1, 2018
1 parent 9d56d97 commit 25071d6
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
Binary file added test/data/10-printStructure-outbound-read-2
Binary file not shown.
Binary file added test/data/9-printStructure-outbound-read-1
Binary file not shown.
53 changes: 53 additions & 0 deletions tests/bugfixes/github/test_issue_263.py
@@ -0,0 +1,53 @@
# -*- coding: utf-8 -*-

import system_tests


class OutOfBoundsReadInPrintIFD(metaclass=system_tests.CaseMeta):

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

encodings = [bytes]

files = [
system_tests.path("$data_path/" + fname) for fname in
(
"10-printStructure-outbound-read-2",
"9-printStructure-outbound-read-1"
)
]
commands = ["$exiv2 -pv " + f for f in files]
stdout = [
bytes(
"""0x0100 Image ImageWidth Short 0
0x0100 Image ImageWidth Short 1 0
0x0102 Image BitsPerSample Short 1 1
0x0103 Image Compression Short 1 3
0x0106 Image PhotometricInterpretation Short 1 0
0x83bb Image IPTCNAA Ascii 244 I*
0x0103 Image Compression Short 1 3
0x0106 Image PhotometricInterpretation Short 1 246
0x014a Image SubIFDs Short 19 8 0 19 256 3 97 0 1728 1024 256 3 1 0 0 0 258 3 1 0
0x0101 Image ImageLength 0x0301 0
""",
encoding='utf-8'
),
bytes("""0x0100 Image ImageWidth Short 0
0x0100 Image ImageWidth Short 0
0x0102 Image BitsPerSample Short 1 1
0x0103 Image Compression Short 1 3
0x0106 Image PhotometricInterpretation Short 1 0
0x0100 Image ImageWidth Short 1 2
0x83bb Image IPTCNAA Ascii 2 """,
encoding='utf-8'
) + bytes([1]) + bytes("""
0x0103 Image Compression Short 1 3
0x0106 Image PhotometricInterpretation Short 1 246
0x014a Image SubIFDs Short 19 42 8 0 19 256 3 97 0 1728 1024 256 3 65 0 0 0 258 3 1
0x0101 Image ImageLength 0x4003 0
0x0106 Image PhotometricInterpretation Short 0
0x0101 Image ImageLength 0xfc03 0
""", encoding='utf-8')
]

compare_stderr = system_tests.check_no_ASAN_UBSAN_errors

0 comments on commit 25071d6

Please sign in to comment.