Skip to content

Commit

Permalink
Fix duplicate vector init in wasm_module_validate (#2498)
Browse files Browse the repository at this point in the history
  • Loading branch information
wenyongh committed Aug 23, 2023
1 parent 377c3d7 commit 858d1dd
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions core/iwasm/common/wasm_c_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -2303,12 +2303,11 @@ wasm_module_validate(wasm_store_t *store, const wasm_byte_vec_t *binary)
}

/* make a copy of binary */
wasm_byte_vec_new_uninitialized(&local_binary, binary->size);
wasm_byte_vec_copy(&local_binary, binary);

if (binary->size && !local_binary.data)
return false;

wasm_byte_vec_copy(&local_binary, binary);

module_rt = wasm_runtime_load((uint8 *)local_binary.data,
(uint32)local_binary.size, error_buf, 128);
wasm_byte_vec_delete(&local_binary);
Expand Down

0 comments on commit 858d1dd

Please sign in to comment.