Merge pull request #108 from D4N/fix_CVE-2017-14860

Fix CVE-2017-14860
v0.27.3
Luis Díaz Más 8 years ago committed by GitHub
commit f06418c656

@ -109,6 +109,7 @@ namespace {
{ 55, N_("tiff directory length is too large") },
{ 56, N_("invalid type value detected in Image::printIFDStructure") },
{ 57, N_("invalid memory allocation request") },
{ 58, N_("corrupted image metadata") },
};
}

@ -269,10 +269,15 @@ namespace Exiv2
std::cout << "Exiv2::Jp2Image::readMetadata: "
<< "Color data found" << std::endl;
#endif
long pad = 3 ; // 3 padding bytes 2 0 0
const long pad = 3 ; // 3 padding bytes 2 0 0
DataBuf data(subBox.length+8);
io_->read(data.pData_,data.size_);
long iccLength = getULong(data.pData_+pad, bigEndian);
const long iccLength = getULong(data.pData_+pad, bigEndian);
// subtracting pad from data.size_ is safe:
// size_ is at least 8 and pad = 3
if (iccLength > data.size_ - pad) {
throw Error(58);
}
DataBuf icc(iccLength);
::memcpy(icc.pData_,data.pData_+pad,icc.size_);
#ifdef DEBUG

@ -730,6 +730,13 @@ source ./functions.source
copyTestFile $filename
runTest exiv2 $filename
num=g71
printf "$num " >&3
filename=003-heap-buffer-over
echo '------>' Bug $filename '<-------' >&2
copyTestFile $filename
runTest exiv2 $filename
) 3>&1 > $results 2>&1
printf "\n"

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save