From 46bf8aac06504b7b0951b06342162db5062ae54c Mon Sep 17 00:00:00 2001 From: noferini <9963644+noferini@users.noreply.github.com> Date: Fri, 16 Aug 2024 10:36:54 +0200 Subject: [PATCH] add check in TOF compressor before to save RDH open --- Detectors/TOF/compression/src/Compressor.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Detectors/TOF/compression/src/Compressor.cxx b/Detectors/TOF/compression/src/Compressor.cxx index 6d08a056852ac..6000e6e9d5185 100644 --- a/Detectors/TOF/compression/src/Compressor.cxx +++ b/Detectors/TOF/compression/src/Compressor.cxx @@ -251,6 +251,17 @@ bool Compressor::processHBF() mErrorCounter++; } + // 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) + if (mEncoderPointer >= mEncoderPointerMax) { + LOG(error) << "link = " << rdh->feeId << ": beyond the buffer size mEncoderPointer in RDH open = " << mEncoderPointer << " >= " + << "mEncoderPointerMax = " << mEncoderPointerMax; + long byteOutOfBuffer = mEncoderPointer + rdh->headerSize - mEncoderPointerMax; + LOG(error) << "byte out of buffer = " << byteOutOfBuffer; + + encoderRewind(); + return true; + } + /** copy RDH close to encoder buffer **/ /** CAREFUL WITH THE PAGE COUNTER **/ if (mEncoderPointer + rdh->headerSize >= mEncoderPointerMax) {