You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found this issue with DPL Output retrieving using binding label.
Let's consider the following piece of code:
auto outputsPtr = std::make_shared<o2f::Outputs>(usrOutputs);
for (constauto& itOutputs : (*outputsPtr)) {
auto fwdMsg = ctx.outputs().make<char>({ itOutputs.binding.value }, msgSize);
std::memcpy(fwdMsg.data(), inputMsg.payload, msgSize);
}
At first the binding of the channels was not set in the usrOutputs elements, but the code was compiling correctly.
At runtime nothing bad happened if usrOutputs size was merely 1.
When using more than one channel the make call fell back to one of them without giving an error message, even if the retrieving using the binding string was faulty.
The issue should be related to DataAllocator::getOutputByBind, not checking for a non empty input string.
The following snippet should be a valid candidate for a fix.
Output getOutputByBind(OutputRef&& ref)
{
if (ref.label == "") {
throwstd::runtime_error("Provided label is empty and cannot be used for OutputSpec retrieving");
assert(false);
}
for (size_t ri = 0, re = mAllowedOutputRoutes.size(); ri != re; ++ri) {
if (mAllowedOutputRoutes[ri].matcher.binding.value == ref.label) {
auto spec = mAllowedOutputRoutes[ri].matcher;
return Output{ spec.origin, spec.description, ref.subSpec, spec.lifetime, std::move(ref.headerStack) };
}
}
throwstd::runtime_error("Unable to find OutputSpec with label " + ref.label);
assert(false);
}
Cheers
Gabriele
The text was updated successfully, but these errors were encountered:
Hello,
I found this issue with DPL
Output
retrieving using binding label.Let's consider the following piece of code:
At first the binding of the channels was not set in the
usrOutputs
elements, but the code was compiling correctly.At runtime nothing bad happened if
usrOutputs
size was merely 1.When using more than one channel the
make
call fell back to one of them without giving an error message, even if the retrieving using the binding string was faulty.The issue should be related to
DataAllocator::getOutputByBind
, not checking for a non empty input string.The following snippet should be a valid candidate for a fix.
Cheers
Gabriele
The text was updated successfully, but these errors were encountered: