exiv2/tests/bugfixes/github/test_issue_1706.py
mergify[bot] 1d64f482ff
fix: use vector::at() rather than operator[] (backport #1735) (#1741)
* fix: use vector::at() rather than operator[] (#1735)

* Regression test for https://github.com/Exiv2/exiv2/issues/1706

* Use vector::at() rather than operator[].

* Print to stderr when exception is caught and EXIV2_DEBUG_MESSAGES is enabled.

* Check that it prints "Bad value" for the date.

(cherry picked from commit f4d3adbf91e6dc4e34aee5bac7b7fd9e127a5c00)

# Conflicts:
#	src/value.cpp

* fix merge conflicts from mergify backport

Co-authored-by: Kevin Backhouse <kevinbackhouse@github.com>
Co-authored-by: Christoph Hasse <hassec@users.noreply.github.com>
2021-06-27 09:33:56 +02:00

25 lines
697 B
Python

# -*- coding: utf-8 -*-
from system_tests import CaseMeta, path
class InvalidDateXMP(metaclass=CaseMeta):
"""
Regression test for the bug described in:
https://github.com/Exiv2/exiv2/issues/1706
"""
url = "https://github.com/Exiv2/exiv2/issues/1706"
filename = path("$data_path/issue_1706_poc.exv")
commands = ["$exiv2 -PE $filename"]
stderr = [
"""Error: Directory Photo with 65280 entries considered invalid; not read.
"""
]
retval = [0]
def compare_stdout(self, i, command, got_stdout, expected_stdout):
# Check that it printed "Bad value" for the date.
self.assertRegex(got_stdout, "Exif.PentaxDng.Date\\s+Long\\s+1\\s+Bad value")