From: Jérémie Astor Date: Thu, 23 Sep 2021 15:30:21 +0000 (+0200) Subject: :bug: more AFL fixes X-Git-Tag: nightly~427 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=11aea26b606001967666edff2b61563889a7a2c3;p=gwion.git :bug: more AFL fixes --- diff --git a/src/lib/deep_equal.c b/src/lib/deep_equal.c index e7e208fd..a94d456a 100644 --- a/src/lib/deep_equal.c +++ b/src/lib/deep_equal.c @@ -27,14 +27,16 @@ static OP_##ACTION(op##action##_deep_##_t##_any) { \ static OP_CHECK(opck_deep_eq_any) { Exp_Binary *bin = data; bin->op = insert_symbol(env->gwion->st, "=="); + exp_self(bin)->exp_type = ae_exp_binary; DECL_ON(const Type, t, = check_exp(env, exp_self(bin))); return t; } static OP_CHECK(opck_deep_ne_any) { Exp_Binary *bin = data; bin->op = insert_symbol(env->gwion->st, "!="); - const Type t = check_exp(env, exp_self(bin)); - return !t ? env->gwion->type[et_error] : env->gwion->type[et_bool]; + exp_self(bin)->exp_type = ae_exp_binary; + DECL_ON(const Type, t, = check_exp(env, exp_self(bin))); + return t; } deep_any(emit, emit, em, EMIT, CHECK_BB, eq, ==); diff --git a/src/lib/lib_func.c b/src/lib/lib_func.c index 07713d65..5ba2f0ff 100644 --- a/src/lib/lib_func.c +++ b/src/lib/lib_func.c @@ -52,7 +52,7 @@ ANN static Exp order_curry(const Env env, Exp fn, Exp arg) { } if (!base) base = next = cpy_nonext(env, curr); - else { + else if(next) { // check me (added after a fuzzing session) next->next = cpy_nonext(env, curr); next = next->next; } diff --git a/src/vm/vm.c b/src/vm/vm.c index 96ba7e92..d8090747 100644 --- a/src/vm/vm.c +++ b/src/vm/vm.c @@ -68,7 +68,7 @@ ANN static uint16_t find_pc(const VM_Shred shred, const Symbol effect, const m_u if (start > shred->pc) break; if (start < shred->pc && VKEY(m, i) > shred->pc) { const m_uint next = VKEY(m, i); - const Instr instr = (Instr)vector_at(&code->instr, next + 1); + const Instr instr = (Instr)vector_at(&code->instr, next); if (!instr->m_val2 || (Symbol)instr->m_val2 == effect) return next + 1; }