diff options
Diffstat (limited to 'src/apply-names.c')
-rw-r--r-- | src/apply-names.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/apply-names.c b/src/apply-names.c index 133808df..23ba7c1a 100644 --- a/src/apply-names.c +++ b/src/apply-names.c @@ -134,8 +134,9 @@ static WasmResult use_name_for_param_and_local_var(Context* ctx, WasmFunc* func, WasmVar* var) { int local_index = wasm_get_local_index_by_var(func, var); - assert(local_index >= 0 && - (size_t)local_index < wasm_get_num_params_and_locals(func)); + if (local_index < 0 || + (size_t)local_index >= wasm_get_num_params_and_locals(func)) + return WASM_ERROR; uint32_t num_params = wasm_get_num_params(func); WasmStringSlice* name; |