diff --git a/bigtiff/parse.cpp b/bigtiff/parse.cpp index 71ab66c3..ba2328d8 100644 --- a/bigtiff/parse.cpp +++ b/bigtiff/parse.cpp @@ -300,13 +300,16 @@ void printIFD(Exiv2::BasicIo& io, std::ostream& out, Exiv2::PrintStructureOption Exiv2::DataBuf buf(size*count + pad); // allocate a buffer - std::memcpy(buf.pData_, &data, 8); // copy data into buffer (short strings) - if ( count*size > 8 ) { // read into buffer - size_t restore = io.tell(); // save - io.seek(offset, Exiv2::BasicIo::beg); // position - io.read(buf.pData_,count*size); // read - io.seek(restore, Exiv2::BasicIo::beg); // restore + // big data? Use 'data' as pointer to real data + if ( count*size > 8 ) // read into buffer + { + size_t restore = io.tell(); // save + io.seek(data, Exiv2::BasicIo::beg); // position + io.read(buf.pData_,count*size); // read + io.seek(restore, Exiv2::BasicIo::beg); // restore } + else // use 'data' as data :) + std::memcpy(buf.pData_, &data, 8); // copy data if ( bPrint ) { uint64_t address = offset + 2 + i*12 ;