Really nail down the args param in rua_obj_msg_sendv().

This commit is contained in:
Bill Currie 2010-01-13 06:36:16 +00:00 committed by Jeff Teunissen
parent dbe0c763d5
commit 00e590f5f5
4 changed files with 10 additions and 7 deletions

View file

@ -204,6 +204,9 @@ int PR_RunLoadFuncs (progs_t *pr);
*/ */
int PR_Check_Opcodes (progs_t *pr); int PR_Check_Opcodes (progs_t *pr);
void PR_BoundsCheckSize (progs_t *pr, int addr, unsigned size);
void PR_BoundsCheck (progs_t *pr, int addr, etype_t type);
//@} //@}
/** \defgroup progs_edict Edict management /** \defgroup progs_edict Edict management

View file

@ -257,7 +257,7 @@ PR_LeaveFunction (progs_t *pr)
&pr->localstack[pr->localstack_used], sizeof (pr_type_t) * c); &pr->localstack[pr->localstack_used], sizeof (pr_type_t) * c);
} }
static void VISIBLE void
PR_BoundsCheckSize (progs_t *pr, int addr, unsigned size) PR_BoundsCheckSize (progs_t *pr, int addr, unsigned size)
{ {
if (addr < 0 || addr >= pr->globals_size if (addr < 0 || addr >= pr->globals_size
@ -266,7 +266,7 @@ PR_BoundsCheckSize (progs_t *pr, int addr, unsigned size)
pr->globals_size, size); pr->globals_size, size);
} }
static void VISIBLE void
PR_BoundsCheck (progs_t *pr, int addr, etype_t type) PR_BoundsCheck (progs_t *pr, int addr, etype_t type)
{ {
PR_BoundsCheckSize (pr, addr, pr_type_size[type]); PR_BoundsCheckSize (pr, addr, pr_type_size[type]);

View file

@ -55,7 +55,7 @@ static __attribute__ ((used)) const char rcsid[] =
#include "compat.h" #include "compat.h"
cvar_t *pr_boundscheck; VISIBLE cvar_t *pr_boundscheck;
cvar_t *pr_deadbeef_ents; cvar_t *pr_deadbeef_ents;
cvar_t *pr_deadbeef_locals; cvar_t *pr_deadbeef_locals;
cvar_t *pr_faultchecks; cvar_t *pr_faultchecks;

View file

@ -912,14 +912,14 @@ rua_obj_msg_sendv (progs_t *pr)
int count = args->count; int count = args->count;
func_t imp = obj_msg_lookup (pr, receiver, op); func_t imp = obj_msg_lookup (pr, receiver, op);
//FIXME bounds checking count = bound (0, count, 6);
if (count && pr_boundscheck->int_val)
PR_BoundsCheckSize (pr, args->list, count * pr->pr_param_size);
if (!imp) if (!imp)
PR_RunError (pr, "%s does not respond to %s", PR_RunError (pr, "%s does not respond to %s",
PR_GetString (pr, object_get_class_name (pr, receiver)), PR_GetString (pr, object_get_class_name (pr, receiver)),
PR_GetString (pr, pr->selector_names[op->sel_id])); PR_GetString (pr, pr->selector_names[op->sel_id]));
if (count > 6) if (count)
count = 6;
if (count > 0)
memcpy (pr->pr_params[2], params, count * 4 * pr->pr_param_size); memcpy (pr->pr_params[2], params, count * 4 * pr->pr_param_size);
PR_CallFunction (pr, imp); PR_CallFunction (pr, imp);
} }