fix_1099_0.27

v0.27.3
clanmills 5 years ago
parent c606de4a83
commit 82087b58e4

@ -1475,6 +1475,11 @@ namespace {
modifyCmd.value_ = value; modifyCmd.value_ = value;
if (cmdId == reg) { if (cmdId == reg) {
if (value.empty()) {
throw Exiv2::Error(Exiv2::kerErrorMessage,
Exiv2::toString(num) + ": " + _("Empty value for key") + + " `" + key + "'");
}
// Registration needs to be done immediately as the new namespaces are // Registration needs to be done immediately as the new namespaces are
// looked up during parsing of subsequent lines (to validate XMP keys). // looked up during parsing of subsequent lines (to validate XMP keys).
Exiv2::XmpProperties::registerNs(modifyCmd.value_, modifyCmd.key_); Exiv2::XmpProperties::registerNs(modifyCmd.value_, modifyCmd.key_);

Binary file not shown.

Binary file not shown.

@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
from system_tests import CaseMeta, path, check_no_ASAN_UBSAN_errors
class EmptyValueInCommandFile(metaclass=CaseMeta):
"""
Regression test for the bug described in:
https://github.com/Exiv2/exiv2/issues/1099
An empty value in the command file causes a std::out_of_range exception.
"""
url = "https://github.com/Exiv2/exiv2/issues/1099"
filename1 = path("$data_path/issue_1099_poc.txt")
filename2 = path("$data_path/issue_1099_poc.bin")
commands = ["$exiv2 -m $filename1 mo $filename2"]
stderr = [
"""$filename1, line 1: Empty value for key `Exiff.LfkInfo.GPSDa'
$exiv2exe: Error parsing -m option arguments
"""]
retval = [1]
def compare_stdout(self, i, command, got_stdout, expected_stdout):
""" We don't care about the stdout, just don't crash """
pass

@ -28,6 +28,7 @@ kerInvalidTypeValue: invalid type value detected in Image::printIFDStructure
kerNotAJpeg : This does not look like a JPEG image kerNotAJpeg : This does not look like a JPEG image
kerNoImageInInputData: Input data does not contain a valid image kerNoImageInInputData: Input data does not contain a valid image
addition_overflow_message: Overflow in addition addition_overflow_message: Overflow in addition
exiv2exe: exiv2${ENV:binary_extension}
exiv2_exception_message: Exiv2 exception in print action for file exiv2_exception_message: Exiv2 exception in print action for file
exiv2_overflow_exception_message: std::overflow_error exception in print action for file exiv2_overflow_exception_message: std::overflow_error exception in print action for file
exception_in_extract: Exiv2 exception in extract action for file exception_in_extract: Exiv2 exception in extract action for file

Loading…
Cancel
Save