mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 22:31:05 +00:00
[gamecode] Fix handling of undefined builtins
The setup of the function descriptor for undefined builtins was incomplete and led to the progs running code at address 0. It didn't end well.
This commit is contained in:
parent
db8cf68ef3
commit
4d491a444d
2 changed files with 3 additions and 4 deletions
|
@ -1898,7 +1898,7 @@ struct progs_s {
|
|||
struct hashtab_s *builtin_hash;
|
||||
struct hashtab_s *builtin_num_hash;
|
||||
struct biblock_s *builtin_blocks;
|
||||
pr_int_t bi_no_function;
|
||||
builtin_t *bi_no_function;
|
||||
unsigned bi_next;
|
||||
unsigned (*bi_map) (progs_t *pr, unsigned binum);
|
||||
///@}
|
||||
|
|
|
@ -121,7 +121,7 @@ PR_RegisterBuiltins (progs_t *pr, builtin_t *builtins, void *data)
|
|||
bi->name = "invalid function";
|
||||
bi->proc = bi_no_function;
|
||||
bi->binum = builtin_next (pr);
|
||||
pr->bi_no_function = bi->binum;
|
||||
pr->bi_no_function = bi;
|
||||
DARRAY_APPEND (pr->builtin_blocks, bi);
|
||||
Hash_AddElement (pr->builtin_num_hash, bi);
|
||||
}
|
||||
|
@ -212,9 +212,8 @@ PR_RelocateBuiltins (progs_t *pr)
|
|||
if (!bi) {
|
||||
Sys_Printf ("PR_RelocateBuiltins: %s: undefined builtin %s\n",
|
||||
pr->progs_name, bi_name);
|
||||
desc->first_statement = -pr->bi_no_function;
|
||||
bi = pr->bi_no_function;
|
||||
bad = 1;
|
||||
continue;
|
||||
}
|
||||
desc->first_statement = -bi->binum;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue