Skip to content

Commit

Permalink
Fix an export name check exception
Browse files Browse the repository at this point in the history
  • Loading branch information
lum1n0us committed Nov 21, 2023
1 parent 9ad4229 commit 96e3b79
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/iwasm/interpreter/wasm_loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -2055,7 +2055,9 @@ load_export_section(const uint8 *buf, const uint8 *buf_end, WASMModule *module,

for (j = 0; j < i; j++) {
name = module->exports[j].name;
if (strlen(name) == str_len && memcmp(name, p, str_len) == 0) {
/* If str_len is zero, the return value of memcmp is zero */
if (str_len && strlen(name) == str_len
&& memcmp(name, p, str_len) == 0) {
set_error_buf(error_buf, error_buf_size,
"duplicate export name");
return false;
Expand Down

0 comments on commit 96e3b79

Please sign in to comment.