commit 3e2b1a3a82bfe9d9147efb33c9d1062025ce3eda
parent 45e611a89ce65ada4eea978bab827cef3623a3bd
Author: William Casarin <jb55@jb55.com>
Date: Fri, 6 Aug 2021 16:40:23 -0700
handle bad table indices
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/wasm.c b/src/wasm.c
@@ -4061,7 +4061,7 @@ static int interp_call_indirect(struct wasm_interp *interp, struct call_indirect
return interp_error(interp, "pop i32");
}
- if (unlikely(i >= (int)table->num_refs)) {
+ if (unlikely(i < 0 || i >= (int)table->num_refs)) {
return interp_error(interp, "invalid index %d in table %d (max %d)",
i, call->tableidx, table->num_refs-1);
}