diff options
author | Mikael Djurfeldt <djurfeldt@nada.kth.se> | 1997-08-14 14:58:25 +0000 |
---|---|---|
committer | Mikael Djurfeldt <djurfeldt@nada.kth.se> | 1997-08-14 14:58:25 +0000 |
commit | adc02cce188dbc20400197af7ee6f7ceac2e108e (patch) | |
tree | 5c333d966dabf3396f7b34b2b6a58c412a9ee3ac /libguile/gsubr.c | |
parent | 4ed948d4f18b3ef34b3f0089ed2631889bd0ebe0 (diff) | |
download | guile-adc02cce188dbc20400197af7ee6f7ceac2e108e.tar.gz |
* gsubr.c (scm_gsubr_apply): From Radey Shouman
<shouman@zianet.com>: "The switch in scm_gsubr_apply that
dispatches on the number of actual args has a default case
reporting an internal error. This is a vestige from a version
that mallocated a SCM vector to hold the arguments. In the
current version this check is too late: if it ever happens we will
have already overstepped the bounds of the array.
Also, the patch [...] adds a check for too many actual arguments."
mdj: Removed check for "internal programming error".
Diffstat (limited to 'libguile/gsubr.c')
-rw-r--r-- | libguile/gsubr.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libguile/gsubr.c b/libguile/gsubr.c index f755f8fe7..c3e865dd2 100644 --- a/libguile/gsubr.c +++ b/libguile/gsubr.c @@ -124,11 +124,15 @@ scm_gsubr_apply(args) SCM v[10]; /* must agree with greatest supported arity */ int typ = SCM_INUM(GSUBR_TYPE(self)); int i, n = GSUBR_REQ(typ) + GSUBR_OPT(typ) + GSUBR_REST(typ); +#if 0 + SCM_ASSERT(n <= sizeof(v)/sizeof(SCM), + self, "internal programming error", s_gsubr_apply); +#endif args = SCM_CDR(args); for (i = 0; i < GSUBR_REQ(typ); i++) { #ifndef RECKLESS if (SCM_IMP(args)) - scm_wrong_num_args (SCM_SNAME(GSUBR_PROC(self))); + wnargs: scm_wrong_num_args (SCM_SNAME(GSUBR_PROC(self))); #endif v[i] = SCM_CAR(args); args = SCM_CDR(args); @@ -143,8 +147,9 @@ scm_gsubr_apply(args) } if (GSUBR_REST(typ)) v[i] = args; + else + SCM_ASRTGO(SCM_NULLP(args), wnargs); switch (n) { - default: scm_wta(self, "internal programming error", s_gsubr_apply); case 2: return (*fcn)(v[0], v[1]); case 3: return (*fcn)(v[0], v[1], v[2]); case 4: return (*fcn)(v[0], v[1], v[2], v[3]); |