mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-12 06:41:13 +02:00
* unif.c (scm_shap2ra): tighten the checking of the array dimension
specifier, since (2) or (2 . 3) would cause SEGV. (scm_transpose_array): more argument checking fixes.
This commit is contained in:
parent
cb1c84cfc8
commit
20a54673cd
3 changed files with 21 additions and 15 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Sat Aug 30 18:56:19 1997 Gary Houston <ghouston@actrix.gen.nz>
|
||||||
|
|
||||||
|
* unif.c (scm_shap2ra): tighten the checking of the array dimension
|
||||||
|
specifier, since (2) or (2 . 3) would cause SEGV.
|
||||||
|
(scm_transpose_array): more argument checking fixes.
|
||||||
|
|
||||||
Wed Aug 27 17:44:44 1997 Jim Blandy <jimb@totoro.red-bean.com>
|
Wed Aug 27 17:44:44 1997 Jim Blandy <jimb@totoro.red-bean.com>
|
||||||
|
|
||||||
* Makefile.in: Regenerated, so it uses "tar", not "gtar".
|
* Makefile.in: Regenerated, so it uses "tar", not "gtar".
|
||||||
|
|
|
@ -128,16 +128,11 @@ scm_string_rindex (str, chr, frm, to)
|
||||||
frm = SCM_BOOL_F;
|
frm = SCM_BOOL_F;
|
||||||
if (to == SCM_UNDEFINED)
|
if (to == SCM_UNDEFINED)
|
||||||
to = SCM_BOOL_F;
|
to = SCM_BOOL_F;
|
||||||
pos = scm_i_index (&str, chr, -1, frm, to, SCM_ARG1, SCM_ARG2, SCM_ARG3, SCM_ARG4, s_string_index);
|
pos = scm_i_index (&str, chr, -1, frm, to, SCM_ARG1, SCM_ARG2, SCM_ARG3, SCM_ARG4, s_string_rindex);
|
||||||
return (pos < 0
|
return (pos < 0
|
||||||
? SCM_BOOL_F
|
? SCM_BOOL_F
|
||||||
: SCM_MAKINUM (pos));
|
: SCM_MAKINUM (pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SCM_PROC(s_substring_move_left_x, "substring-move-left!", 2, 0, 1, scm_substring_move_left_x);
|
SCM_PROC(s_substring_move_left_x, "substring-move-left!", 2, 0, 1, scm_substring_move_left_x);
|
||||||
|
|
||||||
|
|
|
@ -536,18 +536,21 @@ scm_shap2ra (args, what)
|
||||||
if (SCM_IMP (spec))
|
if (SCM_IMP (spec))
|
||||||
|
|
||||||
{
|
{
|
||||||
SCM_ASSERT (SCM_INUMP (spec) && SCM_INUM (spec) >= 0, spec, s_bad_spec, what);
|
SCM_ASSERT (SCM_INUMP (spec) && SCM_INUM (spec) >= 0, spec,
|
||||||
|
s_bad_spec, what);
|
||||||
s->lbnd = 0;
|
s->lbnd = 0;
|
||||||
s->ubnd = SCM_INUM (spec) - 1;
|
s->ubnd = SCM_INUM (spec) - 1;
|
||||||
s->inc = 1;
|
s->inc = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SCM_ASSERT (SCM_CONSP (spec) && SCM_INUMP (SCM_CAR (spec)), spec, s_bad_spec, what);
|
SCM_ASSERT (SCM_CONSP (spec) && SCM_INUMP (SCM_CAR (spec)), spec,
|
||||||
|
s_bad_spec, what);
|
||||||
s->lbnd = SCM_INUM (SCM_CAR (spec));
|
s->lbnd = SCM_INUM (SCM_CAR (spec));
|
||||||
sp = SCM_CDR (spec);
|
sp = SCM_CDR (spec);
|
||||||
SCM_ASSERT (SCM_INUMP (SCM_CAR (sp)) && SCM_NULLP (SCM_CDR (sp)),
|
SCM_ASSERT (SCM_NIMP (sp) && SCM_CONSP (sp)
|
||||||
spec, s_bad_spec, what);
|
&& SCM_INUMP (SCM_CAR (sp)) && SCM_NULLP (SCM_CDR (sp)),
|
||||||
|
spec, s_bad_spec, what);
|
||||||
s->ubnd = SCM_INUM (SCM_CAR (sp));
|
s->ubnd = SCM_INUM (SCM_CAR (sp));
|
||||||
s->inc = 1;
|
s->inc = 1;
|
||||||
}
|
}
|
||||||
|
@ -802,7 +805,7 @@ scm_transpose_array (args)
|
||||||
switch (SCM_TYP7 (ra))
|
switch (SCM_TYP7 (ra))
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
badarg:scm_wta (ra, (char *) SCM_ARGn, s_transpose_array);
|
badarg:scm_wta (ra, (char *) SCM_ARG1, s_transpose_array);
|
||||||
case scm_tc7_bvect:
|
case scm_tc7_bvect:
|
||||||
case scm_tc7_string:
|
case scm_tc7_string:
|
||||||
case scm_tc7_byvect:
|
case scm_tc7_byvect:
|
||||||
|
@ -831,9 +834,11 @@ scm_transpose_array (args)
|
||||||
ndim = 0;
|
ndim = 0;
|
||||||
for (k = 0; k < SCM_ARRAY_NDIM (ra); k++)
|
for (k = 0; k < SCM_ARRAY_NDIM (ra); k++)
|
||||||
{
|
{
|
||||||
|
SCM_ASSERT (SCM_INUMP (ve[k]), ve[k], (SCM_ARG2 + k),
|
||||||
|
s_transpose_array);
|
||||||
i = SCM_INUM (ve[k]);
|
i = SCM_INUM (ve[k]);
|
||||||
SCM_ASSERT (SCM_INUMP (ve[k]) && i >= 0 && i < SCM_ARRAY_NDIM (ra),
|
SCM_ASSERT (i >= 0 && i < SCM_ARRAY_NDIM (ra), ve[k],
|
||||||
ve[k], SCM_ARG2, s_transpose_array);
|
SCM_OUTOFRANGE, s_transpose_array);
|
||||||
if (ndim < i)
|
if (ndim < i)
|
||||||
ndim = i;
|
ndim = i;
|
||||||
}
|
}
|
||||||
|
@ -870,7 +875,7 @@ scm_transpose_array (args)
|
||||||
r->inc += s->inc;
|
r->inc += s->inc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SCM_ASSERT (ndim <= 0, args, "bad argument scm_list", s_transpose_array);
|
SCM_ASSERT (ndim <= 0, args, "bad argument list", s_transpose_array);
|
||||||
scm_ra_set_contp (res);
|
scm_ra_set_contp (res);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -2109,7 +2114,7 @@ scm_array_to_list (v)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static char s_bad_ralst[] = "Bad scm_array contents scm_list";
|
static char s_bad_ralst[] = "Bad scm_array contents list";
|
||||||
|
|
||||||
static int l2ra SCM_P ((SCM lst, SCM ra, scm_sizet base, scm_sizet k));
|
static int l2ra SCM_P ((SCM lst, SCM ra, scm_sizet base, scm_sizet k));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue