Improved RAF support to read thumbnail data which are outside of the Exif block.

v0.27.3
Andreas Huggel 19 years ago
parent 6f35a8e75f
commit b2e00c2d53

@ -89,20 +89,13 @@ namespace Exiv2 {
if (io_->error() || io_->eof()) throw Error(14); if (io_->error() || io_->eof()) throw Error(14);
throw Error(3, "RAF"); throw Error(3, "RAF");
} }
if (io_->seek(84, BasicIo::beg) != 0) throw Error(14); byte const* pData = io_->mmap();
byte tmp[4]; long size = io_->size();
io_->read(tmp, 4); if (size < 84 + 4) throw Error(14); // includes the test for -1
if (io_->error() || io_->eof()) throw Error(14); uint32_t const start = getULong(pData + 84, bigEndian) + 12;
uint32_t const pos = getULong(tmp, bigEndian) + 4; if (static_cast<uint32_t>(size) < start) throw Error(14);
if (io_->seek(pos, BasicIo::beg) != 0) throw Error(14);
io_->read(tmp, 2);
if (io_->error() || io_->eof()) throw Error(14);
DataBuf buf(getUShort(tmp, bigEndian) - 10);
if (io_->seek(pos + 8, BasicIo::beg) != 0) throw Error(14);
io_->read(buf.pData_, buf.size_);
if (io_->error() || io_->eof()) throw Error(14);
clearMetadata(); clearMetadata();
TiffParser::decode(this, buf.pData_, buf.size_, TiffParser::decode(this, pData + start, size - start,
TiffCreator::create, TiffDecoder::findDecoder); TiffCreator::create, TiffDecoder::findDecoder);
} // RafImage::readMetadata } // RafImage::readMetadata

Loading…
Cancel
Save