Skip to content

Commit f4d8e42

Browse files
committed
add check in TOF compressor before to save RDH open
1 parent ed85b4c commit f4d8e42

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

Detectors/TOF/compression/src/Compressor.cxx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,17 @@ bool Compressor<RDH, verbose, paranoid>::processHBF()
251251
mErrorCounter++;
252252
}
253253

254+
// before to move to RDH close check we are not already out of buffer (it is the last chance to call rewind and not to store RDH open)
255+
if (mEncoderPointer >= mEncoderPointerMax) {
256+
LOG(error) << "link = " << rdh->feeId << ": beyond the buffer size mEncoderPointer in RDH open = " << mEncoderPointer << " >= "
257+
<< "mEncoderPointerMax = " << mEncoderPointerMax;
258+
long byteOutOfBuffer = mEncoderPointer + rdh->headerSize - mEncoderPointerMax;
259+
LOG(error) << "byte out of buffer = " << byteOutOfBuffer;
260+
261+
encoderRewind();
262+
return true;
263+
}
264+
254265
/** copy RDH close to encoder buffer **/
255266
/** CAREFUL WITH THE PAGE COUNTER **/
256267
if (mEncoderPointer + rdh->headerSize >= mEncoderPointerMax) {

0 commit comments

Comments
 (0)