Do not print offset when it is used as tag's value

v0.27.3
Michał Walenciak 8 years ago
parent 7d0ea26ca6
commit dff941ad7f

@ -370,7 +370,9 @@ namespace Exiv2 {
// if ( offset > io.size() ) offset = 0; // Denial of service?
DataBuf buf(size*count + pad+20); // allocate a buffer
std::memcpy(buf.pData_,dir.pData_+8,4); // copy dir[8:11] into buffer (short strings)
if ( count*size > 4 ) { // read into buffer
const bool offsetIsPointer = count*size > 4;
if ( offsetIsPointer ) { // read into buffer
size_t restore = io.tell(); // save
io.seek(offset,BasicIo::beg); // position
io.read(buf.pData_,count*size);// read
@ -378,10 +380,14 @@ namespace Exiv2 {
}
if ( bPrint ) {
uint32_t address = start + 2 + i*12 ;
const uint32_t address = start + 2 + i*12 ;
const std::string offsetString = offsetIsPointer?
Internal::stringFormat("%10u", offset):
"";
out << Internal::indent(depth)
<< Internal::stringFormat("%8u | %#06x %-25s |%10s |%9u |%10u | "
,address,tag,tagName(tag).c_str(),typeName(type),count,offset);
<< Internal::stringFormat("%8u | %#06x %-25s |%10s |%9u |%10s | "
,address,tag,tagName(tag).c_str(),typeName(type),count,offsetString.c_str());
if ( isShortType(type) ){
for ( size_t k = 0 ; k < kount ; k++ ) {
out << sp << byteSwap2(buf,k*size,bSwap);

Loading…
Cancel
Save