Initial error handling for max args

Would like something more sophisticated than this, but this is a first-cut of code to prevent segfaulting due to too many arguments being received.
This commit is contained in:
Justin Ethier 2021-03-16 17:14:42 -04:00
parent da7c6e0cf4
commit 31caeff533

View file

@ -6258,6 +6258,12 @@ void Cyc_make_shared_object(void *data, object k, object obj)
void dispatch(void *data, int argc, function_type func, object clo, object cont, void dispatch(void *data, int argc, function_type func, object clo, object cont,
object args) object args)
{ {
if (argc > 100000) {
char buf[128];
snprintf(buf, 127, "Too many arguments %d", argc);
Cyc_rt_raise_msg(data, buf);
}
object b[argc + 1]; // OK to do this? Is this portable? object b[argc + 1]; // OK to do this? Is this portable?
int i; int i;