mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 06:48:12 +00:00
Everywhere: Fix incorrect usages of AK::Checked
Specifically, explicitly specify the checked type, use the resulting value instead of doing the same calculation twice, and break down calculations to discrete operations to ensure no intermediary overflows are missed.
This commit is contained in:
parent
3f70efed9c
commit
301c1a3a58
6 changed files with 16 additions and 15 deletions
|
@ -191,7 +191,7 @@ void BytecodeInterpreter::call_address(Configuration& configuration, FunctionAdd
|
|||
TRAP_IF_NOT(rhs.has_value()); \
|
||||
dbgln_if(WASM_TRACE_DEBUG, "{} {} {} = ??", ulhs.value(), #operator, rhs.value()); \
|
||||
__VA_ARGS__; \
|
||||
Checked lhs = ulhs.value(); \
|
||||
Checked<type> lhs = ulhs.value(); \
|
||||
lhs operator##= rhs.value(); \
|
||||
TRAP_IF_NOT(!lhs.has_overflow()); \
|
||||
auto result = lhs.value(); \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue