Skip to content

Commit e1f4b41

Browse files
jblomerpcanal
authored andcommitted
[io] don't write byte count of large objects (hack)
1 parent ec3bed8 commit e1f4b41

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

io/io/src/TBufferFile.cxx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,13 @@ void TBufferFile::SetByteCount(ULong64_t cntpos, Bool_t packInVersion)
323323
&& (fBufCur >= fBuffer)
324324
&& static_cast<ULong64_t>(fBufCur - fBuffer) <= std::numeric_limits<UInt_t>::max()
325325
&& "Byte count position is after the end of the buffer");
326-
const UInt_t cnt = UInt_t(fBufCur - fBuffer) - UInt_t(cntpos) - sizeof(UInt_t);
326+
327327
char *buf = (char *)(fBuffer + cntpos);
328+
if ((fBufCur - fBuffer - cntpos - sizeof(UInt_t)) >= kMaxMapCount) {
329+
tobuf(buf, 0 | kByteCountMask);
330+
return;
331+
}
332+
const UInt_t cnt = UInt_t(fBufCur - fBuffer) - UInt_t(cntpos) - sizeof(UInt_t);
328333

329334
// if true, pack byte count in two consecutive shorts, so it can
330335
// be read by ReadVersion()

0 commit comments

Comments
 (0)