ctpdev: checking input size instead of output size#12881
ctpdev: checking input size instead of output size#12881shahor02 merged 5 commits intoAliceO2Group:devfrom
Conversation
|
REQUEST FOR PRODUCTION RELEASES: This will add The following labels are available |
|
HI @shahor02 , doing now input size check instead of output. But I am not sure how to do it. Please, have a look. |
aferrero2707
left a comment
There was a problem hiding this comment.
Looks good to me, apart from the suggested use of uint64_t for the variables.
| bool mDoDigits = true; | ||
| o2::pmr::vector<CTPDigit> mOutputDigits; | ||
| int mMaxOutputSize = 0; | ||
| int mMaxInputSize = 0; |
There was a problem hiding this comment.
I would use uint64_t to allow for large values.
| mOutputLumiInfo.inp2 = inp2; | ||
| mMaxOutputSize = ctx.options().get<int>("max-output-size"); | ||
| LOG(info) << "CTP reco init done. Inputs decoding here:" << decodeinps << " DoLumi:" << mDoLumi << " DoDigits:" << mDoDigits << " NTF:" << mNTFToIntegrate << " Lumi inputs:" << lumiinp1 << ":" << inp1 << " " << lumiinp2 << ":" << inp2 << " Max errors:" << maxerrors << " Max output size:" << mMaxOutputSize; | ||
| mMaxInputSize = ctx.options().get<int>("max-input-size"); |
There was a problem hiding this comment.
Replace int by uint64_t
| std::vector<InputSpec> filter{InputSpec{"filter", ConcreteDataTypeMatcher{"CTP", "RAWDATA"}, Lifetime::Timeframe}}; | ||
| { | ||
| size_t payloadSize = 0; | ||
| for (const auto& ref : o2::framework::InputRecordWalker(inputs, filter)) { |
There was a problem hiding this comment.
Also here, use uint64_t instead of size_t, to protect from large values.
| const auto dh = o2::framework::DataRefUtils::getHeader<o2::header::DataHeader*>(ref); | ||
| payloadSize += o2::framework::DataRefUtils::getPayloadSize(ref); | ||
| } | ||
| if ((mMaxInputSize > 0) && (payloadSize > (size_t)mMaxInputSize)) { |
There was a problem hiding this comment.
No need to cast to size_t if they are both defined as uint64_t
|
@aferrero2707 : as far as I can see your comment contradict @shahor02 comments - see resolved. So I leave it to you to discuss with @shahor02 . |
|
I think it is already safe: the max allowed size ( |
|
@aferrero2707 @shahor02 Thanks. |
|
Please, merge. |
* dev: checking max input size * clang * dev: input size check * clang * fix: size_t
* dev: checking max input size * clang * dev: input size check * clang * fix: size_t
* dev: checking max input size * clang * dev: input size check * clang * fix: size_t
No description provided.