Merge pull request #1918 from rabauke/my_fix_01

fix out of range access, minor performance improvement
This commit is contained in:
Kevin Backhouse
2021-09-24 10:55:45 +01:00
committed by GitHub
3 changed files with 19 additions and 2 deletions
+2 -2
View File
@@ -3265,8 +3265,8 @@ namespace Exiv2 {
}
std::string stringValue = value.toString();
if (stringValue.at(19) == 'Z') {
stringValue = stringValue.substr(0, 19);
if (stringValue.size() == 20 && stringValue.at(19) == 'Z') {
stringValue.pop_back();
}
std::replace(stringValue.begin(), stringValue.end(), 'T', ' ');
std::replace(stringValue.begin(), stringValue.end(), '-', ':');
Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

+17
View File
@@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
from system_tests import CaseMeta, path, check_no_ASAN_UBSAN_errors
class PrintXmpDateOutOfBoundsIndex19(metaclass=CaseMeta):
"""
Regression test for the bug described in:
https://github.com/Exiv2/exiv2/issues/1918
"""
url = "https://github.com/Exiv2/exiv2/issues/1918"
filename = path("$data_path/issue_1918_poc.jpg")
commands = ["$exiv2 -px $filename"]
stderr = [""]
retval = [0]
compare_stdout = check_no_ASAN_UBSAN_errors