exiv2/tests/bugfixes/github/test_issue_851.py
Kevin Backhouse b35cc5ffa6
Credit to OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=37363
Do some basic XML validation before running the xmpsdk library to avoid bugs in xmpsdk.
2021-08-21 12:42:24 +01:00

32 lines
965 B
Python

# -*- coding: utf-8 -*-
from system_tests import CaseMeta, path
class DenialOfServiceInAdjustTimeOverflow(metaclass=CaseMeta):
"""
Regression test for the bug described in:
https://github.com/Exiv2/exiv2/issues/851
The date parsing code in XMPUtils::ConvertToDate does not
check that the month and day are in bounds. This can cause a
denial of service in AdjustTimeOverflow because it adjusts
out-of-bounds days in a loop that subtracts one month per
iteration.
"""
url = "https://github.com/Exiv2/exiv2/issues/851"
filename = path("$data_path/issue_851_poc.xmp")
commands = ["$exiv2 $filename"]
stdout = ["""File name : $filename
File size : 317 Bytes
MIME type : application/rdf+xml
Image size : 0 x 0
"""
]
stderr = ["""Error: XMP Toolkit error 201: Error in XMLValidator
Warning: Failed to decode XMP metadata.
$filename: No Exif data found in the file
"""]
retval = [253]