From ae32384a1544a332a26580489476e30f8977f1f2 Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Sat, 8 Jun 2019 11:27:16 +0200 Subject: [PATCH] :art: Variadic security --- src/emit/emit.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/emit/emit.c b/src/emit/emit.c index 6683d9e7..6f7d6aac 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -1570,6 +1570,10 @@ ANN static m_bool emit_vararg(const Emitter emit, const Exp_Dot* member) { emit_vararg_end(emit, offset); return GW_OK; } + if(!get_variadic(emit)) + ERR_B(exp_self(member)->pos, "vararg.%s used before vararg.start. this is an error", s_name(member->xid)) + if(GET_FLAG(emit->env->func, empty)) + ERR_B(exp_self(member)->pos, "vararg.%s used after vararg.end. this is an error", s_name(member->xid)) const Instr instr = emit_add_instr(emit, VarargMember); instr->m_val = offset; instr->m_val2 = exp_self(member)->type->size; -- 2.43.0