Skip to content

Commit

Permalink
Add unit test for endless loop in case of malformed effect.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rot127 committed Oct 25, 2023
1 parent e1a957e commit 0025d1c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/unit/test_il_validate.c
Original file line number Diff line number Diff line change
Expand Up @@ -1086,6 +1086,18 @@ static bool test_il_validate_effect_repeat() {
mu_assert_streq_free(report, "Body operand of repeat op does not only perform data effects.", "report");
rz_il_op_effect_free(op);

//////////////////////////
// malformed effect handling

op = rz_il_op_new_seqn(2,
rz_il_op_new_set("x", true, rz_il_op_new_bitv_from_ut64(32, 1)),
rz_il_op_new_repeat(rz_il_op_new_non_zero(rz_il_op_new_var("x", RZ_IL_VAR_KIND_LOCAL)),
rz_il_op_new_set("x", true, rz_il_op_new_sub(rz_il_op_new_var("x", RZ_IL_VAR_KIND_LOCAL), rz_il_op_new_b1()))));
val = rz_il_validate_effect(op, ctx, &local_var_sorts, &t, &report);
mu_assert_false(val, "invalid");
mu_assert_streq_free(report, "Right operand of sub op is not a bitvector.", "report");
rz_il_op_effect_free(op);

rz_il_validate_global_context_free(ctx);
mu_end;
}
Expand Down

0 comments on commit 0025d1c

Please sign in to comment.