commit aac17c85798b8962ffc038ac3d4b203eb1f4a29b
parent 89b9ea45740af4ebc44b1ae8df388a600f83e5e7
Author: Eyal Sawady <ecs@d2evs.net>
Date: Sun, 16 Jan 2022 20:10:17 +0000
gen: fix bounds check on slice assignment
Signed-off-by: Eyal Sawady <ecs@d2evs.net>
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/gen.c b/src/gen.c
@@ -809,7 +809,7 @@ gen_expr_assign_slice(struct gen_context *ctx, const struct expression *expr)
struct qbe_value binvalid = mklabel(ctx, &linvalid, ".%d");
struct qbe_value bvalid = mklabel(ctx, &lvalid, ".%d");
struct qbe_value tmp = mkqtmp(ctx, &qbe_long, ".%d");
- pushi(ctx->current, &tmp, Q_CUGEL, &olen, &vlen, NULL);
+ pushi(ctx->current, &tmp, Q_CEQL, &olen, &vlen, NULL);
pushi(ctx->current, NULL, Q_JNZ, &tmp, &bvalid, &binvalid, NULL);
push(&ctx->current->body, &linvalid);
gen_fixed_abort(ctx, expr->loc, ABORT_OOB);