wasm loader: Fix push_frame_offset when pushing v128 type (#3588)
Fixes issue https://github.com/bytecodealliance/wasm-micro-runtime/issues/3580.
This commit is contained in:
@ -9315,6 +9315,8 @@ wasm_loader_push_frame_offset(WASMLoaderContext *ctx, uint8 type,
|
|||||||
bool disable_emit, int16 operand_offset,
|
bool disable_emit, int16 operand_offset,
|
||||||
char *error_buf, uint32 error_buf_size)
|
char *error_buf, uint32 error_buf_size)
|
||||||
{
|
{
|
||||||
|
uint32 cell_num_to_push, i;
|
||||||
|
|
||||||
if (type == VALUE_TYPE_VOID)
|
if (type == VALUE_TYPE_VOID)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -9341,21 +9343,24 @@ wasm_loader_push_frame_offset(WASMLoaderContext *ctx, uint8 type,
|
|||||||
if (is_32bit_type(type))
|
if (is_32bit_type(type))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (ctx->p_code_compiled == NULL) {
|
cell_num_to_push = wasm_value_type_cell_num(type) - 1;
|
||||||
if (!check_offset_push(ctx, error_buf, error_buf_size))
|
for (i = 0; i < cell_num_to_push; i++) {
|
||||||
return false;
|
if (ctx->p_code_compiled == NULL) {
|
||||||
}
|
if (!check_offset_push(ctx, error_buf, error_buf_size))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
ctx->frame_offset++;
|
ctx->frame_offset++;
|
||||||
if (!disable_emit) {
|
if (!disable_emit) {
|
||||||
ctx->dynamic_offset++;
|
ctx->dynamic_offset++;
|
||||||
if (ctx->dynamic_offset > ctx->max_dynamic_offset) {
|
if (ctx->dynamic_offset > ctx->max_dynamic_offset) {
|
||||||
ctx->max_dynamic_offset = ctx->dynamic_offset;
|
ctx->max_dynamic_offset = ctx->dynamic_offset;
|
||||||
if (ctx->max_dynamic_offset >= INT16_MAX) {
|
if (ctx->max_dynamic_offset >= INT16_MAX)
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
|
|||||||
@ -4869,6 +4869,8 @@ wasm_loader_push_frame_offset(WASMLoaderContext *ctx, uint8 type,
|
|||||||
bool disable_emit, int16 operand_offset,
|
bool disable_emit, int16 operand_offset,
|
||||||
char *error_buf, uint32 error_buf_size)
|
char *error_buf, uint32 error_buf_size)
|
||||||
{
|
{
|
||||||
|
uint32 cell_num_to_push, i;
|
||||||
|
|
||||||
if (type == VALUE_TYPE_VOID)
|
if (type == VALUE_TYPE_VOID)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -4893,19 +4895,23 @@ wasm_loader_push_frame_offset(WASMLoaderContext *ctx, uint8 type,
|
|||||||
if (is_32bit_type(type))
|
if (is_32bit_type(type))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (ctx->p_code_compiled == NULL) {
|
cell_num_to_push = wasm_value_type_cell_num(type) - 1;
|
||||||
if (!check_offset_push(ctx, error_buf, error_buf_size))
|
for (i = 0; i < cell_num_to_push; i++) {
|
||||||
return false;
|
if (ctx->p_code_compiled == NULL) {
|
||||||
}
|
if (!check_offset_push(ctx, error_buf, error_buf_size))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
ctx->frame_offset++;
|
ctx->frame_offset++;
|
||||||
if (!disable_emit) {
|
if (!disable_emit) {
|
||||||
ctx->dynamic_offset++;
|
ctx->dynamic_offset++;
|
||||||
if (ctx->dynamic_offset > ctx->max_dynamic_offset) {
|
if (ctx->dynamic_offset > ctx->max_dynamic_offset) {
|
||||||
ctx->max_dynamic_offset = ctx->dynamic_offset;
|
ctx->max_dynamic_offset = ctx->dynamic_offset;
|
||||||
bh_assert(ctx->max_dynamic_offset < INT16_MAX);
|
bh_assert(ctx->max_dynamic_offset < INT16_MAX);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user