mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2026-02-05 16:11:51 +00:00
fix: correct boundary check in dynamic_offset check (#4788)
correct boundary check in check_dynamic_offset_pop when dynamic_offset is 0. When dynamic_offset = 0, check_dynamic_offset_pop will always return true, which may wrongly update dynamic_offset. also include a typo fix in SET_OPERAND_REF Signed-off-by: zhenweijin <zhenwei.jin@intel.com>
This commit is contained in:
parent
29767f6b51
commit
23df0d4e55
|
|
@ -442,7 +442,7 @@ wasm_interp_get_frame_ref(WASMInterpFrame *frame)
|
|||
opnd_off = *(int16 *)(frame_ip + off); \
|
||||
addr_tmp = frame_lp + opnd_off; \
|
||||
PUT_REF_TO_ADDR(addr_tmp, value); \
|
||||
SET_FRAME_REF(ond_off); \
|
||||
SET_FRAME_REF(opnd_off); \
|
||||
} while (0)
|
||||
|
||||
#define SET_OPERAND(op_type, off, value) SET_OPERAND_##op_type(off, value)
|
||||
|
|
|
|||
|
|
@ -8545,8 +8545,7 @@ check_offset_pop(WASMLoaderContext *ctx, uint32 cells)
|
|||
static bool
|
||||
check_dynamic_offset_pop(WASMLoaderContext *ctx, uint32 cells)
|
||||
{
|
||||
if (ctx->dynamic_offset < 0
|
||||
|| (ctx->dynamic_offset > 0 && (uint32)ctx->dynamic_offset < cells))
|
||||
if (ctx->dynamic_offset < 0 || (uint32)ctx->dynamic_offset < cells)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4345,8 +4345,7 @@ check_offset_pop(WASMLoaderContext *ctx, uint32 cells)
|
|||
static bool
|
||||
check_dynamic_offset_pop(WASMLoaderContext *ctx, uint32 cells)
|
||||
{
|
||||
if (ctx->dynamic_offset < 0
|
||||
|| (ctx->dynamic_offset > 0 && (uint32)ctx->dynamic_offset < cells))
|
||||
if (ctx->dynamic_offset < 0 || (uint32)ctx->dynamic_offset < cells)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user