mes: Prevent out-of-bounds access for stack frame 0.
* src/lib.c (make_frame): Add a check to prevent reads outside of the stack when trying to determine the procedure for stack frame 0.
This commit is contained in:
parent
c480c7e602
commit
d7b2e0ab9b
|
@ -1,6 +1,7 @@
|
||||||
/* -*-comment-start: "//";comment-end:""-*-
|
/* -*-comment-start: "//";comment-end:""-*-
|
||||||
* GNU Mes --- Maxwell Equations of Software
|
* GNU Mes --- Maxwell Equations of Software
|
||||||
* Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
* Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||||
|
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
|
||||||
*
|
*
|
||||||
* This file is part of GNU Mes.
|
* This file is part of GNU Mes.
|
||||||
*
|
*
|
||||||
|
@ -320,8 +321,12 @@ SCM
|
||||||
make_frame (SCM stack, long index)
|
make_frame (SCM stack, long index)
|
||||||
{
|
{
|
||||||
SCM frame_type = make_frame_type ();
|
SCM frame_type = make_frame_type ();
|
||||||
|
SCM procedure = 0;
|
||||||
|
if (index != 0)
|
||||||
|
{
|
||||||
long array_index = (STACK_SIZE - (index * FRAME_SIZE));
|
long array_index = (STACK_SIZE - (index * FRAME_SIZE));
|
||||||
SCM procedure = g_stack_array[array_index + FRAME_PROCEDURE];
|
procedure = g_stack_array[array_index + FRAME_PROCEDURE];
|
||||||
|
}
|
||||||
if (!procedure)
|
if (!procedure)
|
||||||
procedure = cell_f;
|
procedure = cell_f;
|
||||||
SCM values = cell_nil;
|
SCM values = cell_nil;
|
||||||
|
|
Loading…
Reference in a new issue