From a37e2ab26a8b5926c4e8d06bef3f0a3895623034 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 15 Apr 2011 10:50:09 -0700 Subject: [PATCH] Fix bug where globals can be assigned invalid memory (bug 4643, r=ds). --- sourcepawn/compiler/sc3.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sourcepawn/compiler/sc3.c b/sourcepawn/compiler/sc3.c index 9c71fa25..fa5b9b5f 100644 --- a/sourcepawn/compiler/sc3.c +++ b/sourcepawn/compiler/sc3.c @@ -2386,7 +2386,14 @@ static int nesting=0; assert(sc_status==statFIRST || arg[argidx].ident == 0 || arg[argidx].tags!=NULL); switch (arg[argidx].ident) { case 0: + /* On the first pass, we don't have all of the parameter info. + * However, use information must be marked anyway, otherwise vars + * declared previously will be omitted in the second pass. See + * SourceMod bug 4643. + */ error(92); /* argument count mismatch */ + if (lval.sym) + markusage(lval.sym,uWRITTEN); break; case iVARARGS: /* always pass by reference */