Skip to content

Commit 4515db1

Browse files
committed
io: Clarify byte count related limits
1 parent b078895 commit 4515db1

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

io/io/src/TBufferFile.cxx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3159,7 +3159,8 @@ Version_t TBufferFile::ReadVersion(UInt_t *startpos, UInt_t *bcnt, const TClass
31593159
// before reading object save start position
31603160
auto full_startpos = fBufCur - fBuffer;
31613161
*startpos = full_startpos <= kMaxCountPosition ? UInt_t(full_startpos) : kOverflowPosition;
3162-
fByteCountStack.push_back({(size_t)full_startpos, cl, nullptr});
3162+
if (bcnt)
3163+
fByteCountStack.push_back({(size_t)full_startpos, cl, nullptr});
31633164
}
31643165

31653166
// read byte count (older files don't have byte count)
@@ -3196,7 +3197,8 @@ Version_t TBufferFile::ReadVersion(UInt_t *startpos, UInt_t *bcnt, const TClass
31963197
// did not fit and thus we stored it in 'fByteCounts' instead.
31973198
// Mark this case by setting startpos to kOverflowCount.
31983199
*bcnt = kOverflowCount;
3199-
*startpos = kOverflowPosition;
3200+
if (startpos)
3201+
*startpos = kOverflowPosition;
32003202
}
32013203
}
32023204
}
@@ -3302,7 +3304,8 @@ Version_t TBufferFile::ReadVersionNoCheckSum(UInt_t *startpos, UInt_t *bcnt)
33023304
auto full_startpos = fBufCur - fBuffer;
33033305
*startpos = full_startpos < kMaxCountPosition ? UInt_t(full_startpos) : kOverflowPosition;
33043306
// TODO: Extend ReadVersionNoCheckSum to take the class pointer.
3305-
fByteCountStack.push_back({(size_t)full_startpos, nullptr, nullptr});
3307+
if (bcnt)
3308+
fByteCountStack.push_back({(size_t)full_startpos, nullptr, nullptr});
33063309
}
33073310

33083311
// read byte count (older files don't have byte count)
@@ -3338,7 +3341,8 @@ Version_t TBufferFile::ReadVersionNoCheckSum(UInt_t *startpos, UInt_t *bcnt)
33383341
// did not fit and thus we stored it in 'fByteCounts' instead.
33393342
// Mark this case by setting startpos to kOverflowCount.
33403343
*bcnt = kOverflowCount;
3341-
*startpos = kOverflowPosition;
3344+
if (startpos)
3345+
*startpos = kOverflowPosition;
33423346
}
33433347
}
33443348
}

0 commit comments

Comments
 (0)