mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-25 00:54:32 +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:
committed by
Linus Groh
parent
3f70efed9c
commit
301c1a3a58
@@ -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(); \
|
||||
|
||||
Reference in New Issue
Block a user