-
Notifications
You must be signed in to change notification settings - Fork 208
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Bug Report: Missing Error Handling in ModBuiltinRunner::fill_value
Issue Description
The Rust implementation of fill_value in ModBuiltinRunner returns false when it can't fill a value, but the calling code in fill_memory doesn't properly handle this case for the mul_mod runner, unlike the Python implementation which raises an exception.
Impact
This leads to infinite loops in case the input is malformed. This has no known production impacts, but should be handled.
Proposed Fix
Update the fill_memory function to properly handle the false return value from fill_value by returning an error:
if mul_mod_index < mul_mod_n {
if let Some((_, mul_mod_runner, _)) = mul_mod {
if mul_mod_runner.fill_value(memory, &mul_mod_inputs, mul_mod_index)? {
mul_mod_index += 1;
continue;
} else {
return Err(RunnerError::FillMemoryCoudNotFillTable(
add_mod_index,
mul_mod_index,
));
}
}
}
This change ensures that when fill_value returns false (indicating it couldn't fill a value), the function immediately returns an error rather than continuing execution, matching the behavior of the Python reference implementation.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working