@@ -1934,8 +1934,8 @@ wasm_frame_vec_clone_internal(Vector *src, Vector *out)
19341934 return ;
19351935 }
19361936
1937- bh_memcpy_s (out -> data , src -> num_elems * sizeof (WASMCApiFrame ), src -> data ,
1938- src -> num_elems * sizeof (WASMCApiFrame ));
1937+ bh_memcpy_s (out -> data , ( uint32 )( src -> num_elems * sizeof (WASMCApiFrame )) ,
1938+ src -> data , ( uint32 )( src -> num_elems * sizeof (WASMCApiFrame ) ));
19391939 out -> num_elems = src -> num_elems ;
19401940}
19411941
@@ -2962,8 +2962,10 @@ wasm_func_new_basic(wasm_store_t *store, const wasm_functype_t *type,
29622962 if (!(func -> type = wasm_functype_copy (type ))) {
29632963 goto failed ;
29642964 }
2965- func -> param_count = func -> type -> params -> num_elems ;
2966- func -> result_count = func -> type -> results -> num_elems ;
2965+ /* func type's param_count and result_count were checked in
2966+ loader and are no larger than UINT16_MAX */
2967+ func -> param_count = (uint16 )func -> type -> params -> num_elems ;
2968+ func -> result_count = (uint16 )func -> type -> results -> num_elems ;
29672969
29682970 RETURN_OBJ (func , wasm_func_delete )
29692971}
@@ -2994,8 +2996,10 @@ wasm_func_new_with_env_basic(wasm_store_t *store, const wasm_functype_t *type,
29942996 if (!(func -> type = wasm_functype_copy (type ))) {
29952997 goto failed ;
29962998 }
2997- func -> param_count = func -> type -> params -> num_elems ;
2998- func -> result_count = func -> type -> results -> num_elems ;
2999+ /* func type's param_count and result_count were checked in
3000+ loader and are no larger than UINT16_MAX */
3001+ func -> param_count = (uint16 )func -> type -> params -> num_elems ;
3002+ func -> result_count = (uint16 )func -> type -> results -> num_elems ;
29993003
30003004 RETURN_OBJ (func , wasm_func_delete )
30013005}
@@ -3085,8 +3089,10 @@ wasm_func_new_internal(wasm_store_t *store, uint16 func_idx_rt,
30853089 if (!func -> type ) {
30863090 goto failed ;
30873091 }
3088- func -> param_count = func -> type -> params -> num_elems ;
3089- func -> result_count = func -> type -> results -> num_elems ;
3092+ /* func type's param_count and result_count were checked in
3093+ loader and are no larger than UINT16_MAX */
3094+ func -> param_count = (uint16 )func -> type -> params -> num_elems ;
3095+ func -> result_count = (uint16 )func -> type -> results -> num_elems ;
30903096
30913097 /* will add name information when processing "exports" */
30923098 func -> store = store ;
0 commit comments