Merge pull request #207 from D4N/fix_cve_2018_4868

Fix CVE-2018-4868
v0.27.3
D4N 7 years ago committed by GitHub
commit 9cddfa514d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -268,7 +268,12 @@ namespace Exiv2
#endif
const long pad = 3 ; // 3 padding bytes 2 0 0
DataBuf data(Safe::add(subBox.length, static_cast<uint32_t>(8)));
const size_t data_length = Safe::add(subBox.length, static_cast<uint32_t>(8));
// data_length makes no sense if it is larger than the rest of the file
if (data_length > io_->size() - io_->tell()) {
throw Error(58);
}
DataBuf data(data_length);
io_->read(data.pData_,data.size_);
const long iccLength = getULong(data.pData_+pad, bigEndian);
// subtracting pad from data.size_ is safe:

Binary file not shown.

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
import system_tests
class TestCvePoC(system_tests.Case):
url = "https://github.com/Exiv2/exiv2/issues/202"
cve_url = "http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-4868"
found_by = ["afl", "topsecLab", "xcainiao"]
filename = "{data_path}/exiv2-memorymmap-error"
commands = ["{exiv2} " + filename]
stdout = [""]
stderr = ["""{exiv2_exception_msg} """ + filename + """:
{error_58_message}
"""]
retval = [1]
Loading…
Cancel
Save