mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
[gamecode] Check entity_var is valid before display
Even NUM_FOR_BAD_EDICT will have a bad day if the edict pointer is invalid, so make sure that the entity pointer is valid (within the edict area AND a multiple of edict size).
This commit is contained in:
parent
95991e0d77
commit
6368791d2b
1 changed files with 3 additions and 1 deletions
|
@ -1252,7 +1252,9 @@ pr_debug_entity_view (qfot_type_t *type, pr_type_t *value, void *_data)
|
|||
progs_t *pr = data->pr;
|
||||
dstring_t *dstr = data->dstr;
|
||||
|
||||
if (pr->pr_edicts) {
|
||||
if (pr->pr_edicts && value->entity_var >= 0
|
||||
&& value->entity_var < pr->max_edicts
|
||||
&& !(value->entity_var % pr->pr_edict_size)) {
|
||||
edict_t *edict = PROG_TO_EDICT (pr, value->entity_var);
|
||||
if (edict) {
|
||||
dasprintf (dstr, "entity %d", NUM_FOR_BAD_EDICT (pr, edict));
|
||||
|
|
Loading…
Reference in a new issue