#1286 Fix submitted.

This commit is contained in:
Robin Mills 2017-04-05 18:36:14 +00:00
parent 03fd02827f
commit 5a5f7dc1ac

View File

@ -465,22 +465,24 @@ namespace Exiv2 {
}
int chunk = (int) buf.pData_[2+12];
int chunks = (int) buf.pData_[2+13];
#ifdef DEBUG
// ICC1v43_2010-12.pdf header is 14 bytes
// header = "ICC_PROFILE\0" (12 bytes)
// chunk/chunks are a single byte
// Spec 7.2 Profile bytes 0-3 size
uint32_t s = getULong(buf.pData_ + (2+14) , bigEndian);
//#ifdef DEBUG
std::cerr << "Found ICC Profile chunk " << chunk
<< " of " << chunks
<< (chunk==1 ? " size: " : "" ) << (chunk==1 ? s : 0)
<< std::endl ;
#endif
//#endif
io_->seek(-bufRead, BasicIo::cur); // back up to start of buffer (after marker)
io_->seek( 14+2, BasicIo::cur); // step header
// read in profile
DataBuf icc(size-2-14) ;
// #1286 profile can be padded
DataBuf icc((chunk==1&&chunks==1)?s:size-2-14);
if ( icc.size_ > size-2-14) throw Error(53);
io_->read( icc.pData_,icc.size_);
if ( !iccProfileDefined() ) { // first block of profile