From abaad9b900697b966373f3b9259ee68b704be605 Mon Sep 17 00:00:00 2001 From: shahoian Date: Thu, 4 Jun 2026 11:11:02 +0200 Subject: [PATCH] Avoid casting empty buffer to ITS/MFT CTF ref. --- .../common/workflow/src/EntropyDecoderSpec.cxx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Detectors/ITSMFT/common/workflow/src/EntropyDecoderSpec.cxx b/Detectors/ITSMFT/common/workflow/src/EntropyDecoderSpec.cxx index 1107ca2fd34f6..7c8bfe7dfed67 100644 --- a/Detectors/ITSMFT/common/workflow/src/EntropyDecoderSpec.cxx +++ b/Detectors/ITSMFT/common/workflow/src/EntropyDecoderSpec.cxx @@ -71,10 +71,12 @@ void EntropyDecoderSpec::run(ProcessingContext& pc) auto buff = pc.inputs().get>(getBinding(nm + "CTF", iLayer)); // since the buff is const, we cannot use EncodedBlocks::relocate directly, instead we wrap its data to another flat object // const auto ctfImage = o2::itsmft::CTF::getImage(buff.data()); - const auto& ctf = o2::itsmft::CTF::getImage(buff.data()); - if (ctf.getHeader().maxStreams != nLayers) { - LOGP(fatal, "Number of streams {} in the CTF header is not equal to NLayers {} from AlpideParam in {}staggered mode", - ctf.getHeader().maxStreams, nLayers, mDoStaggering ? "" : "non-"); + if (buff.size()) { + const auto& ctf = o2::itsmft::CTF::getImage(buff.data()); + if (ctf.getHeader().maxStreams != nLayers) { + LOGP(fatal, "Number of streams {} in the CTF header is not equal to NLayers {} from AlpideParam in {}staggered mode", + ctf.getHeader().maxStreams, nLayers, mDoStaggering ? "" : "non-"); + } } // this produces weird memory problems in unrelated devices, to be understood // auto& trigs = pc.outputs().make>(OutputRef{"phystrig"}); // dummy output @@ -82,7 +84,7 @@ void EntropyDecoderSpec::run(ProcessingContext& pc) if (mGetDigits) { auto& digits = pc.outputs().make>(OutputRef{nm + "Digits", iLayer}); if (buff.size()) { - iosize += mCTFCoder.decode(ctf, rofs, digits, mNoiseMap, mPattIdConverter); + iosize += mCTFCoder.decode(o2::itsmft::CTF::getImage(buff.data()), rofs, digits, mNoiseMap, mPattIdConverter); } ndigcl += digits.size(); nrofs += rofs.size(); @@ -90,7 +92,7 @@ void EntropyDecoderSpec::run(ProcessingContext& pc) auto& compcl = pc.outputs().make>(OutputRef{nm + "compClusters", iLayer}); auto& patterns = pc.outputs().make>(OutputRef{nm + "patterns", iLayer}); if (buff.size()) { - iosize += mCTFCoder.decode(ctf, rofs, compcl, patterns, mNoiseMap, mPattIdConverter); + iosize += mCTFCoder.decode(o2::itsmft::CTF::getImage(buff.data()), rofs, compcl, patterns, mNoiseMap, mPattIdConverter); } ndigcl += compcl.size(); }