mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
[qfcc] Catch erroneous negative builtin numbers
Setting a builtin number negative makes it a non-builtin function, but possibly in the middle of another function. Not good.
This commit is contained in:
parent
0db617719e
commit
5893bd7501
1 changed files with 4 additions and 0 deletions
|
@ -656,6 +656,10 @@ build_builtin_function (symbol_t *sym, expr_t *bi_val, int far)
|
||||||
bi = expr_integer (bi_val);
|
bi = expr_integer (bi_val);
|
||||||
else
|
else
|
||||||
bi = expr_float (bi_val);
|
bi = expr_float (bi_val);
|
||||||
|
if (bi < 0) {
|
||||||
|
error (bi_val, "builtin functions must be positive or 0");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
sym->s.func->builtin = bi;
|
sym->s.func->builtin = bi;
|
||||||
reloc_def_func (sym->s.func, sym->s.func->def);
|
reloc_def_func (sym->s.func, sym->s.func->def);
|
||||||
build_function (sym);
|
build_function (sym);
|
||||||
|
|
Loading…
Reference in a new issue