From bf33c410794a28935302c62d8f9028b261288e47 Mon Sep 17 00:00:00 2001 From: "Guillermo J. Rozas" Date: Wed, 23 Mar 1988 18:45:39 +0000 Subject: [PATCH] Add some overflow checking in entity apply code. It will not work in fscheme/multischeme, but figuring out what the right thing to do there is not easy. --- v7/src/microcode/interp.c | 14 +++++++++++--- v8/src/microcode/interp.c | 14 +++++++++++--- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/v7/src/microcode/interp.c b/v7/src/microcode/interp.c index 0ce0040a5..2c88b5463 100644 --- a/v7/src/microcode/interp.c +++ b/v7/src/microcode/interp.c @@ -30,7 +30,7 @@ Technology nor of any adaptation thereof in any advertising, promotional, or sales literature without prior written consent from MIT in each case. */ -/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/interp.c,v 9.42 1988/03/23 18:31:25 jrm Exp $ +/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/interp.c,v 9.43 1988/03/23 18:45:39 jinx Rel $ * * This file contains the heart of the Scheme Scode * interpreter @@ -1375,11 +1375,19 @@ Perform_Application: /* This code assumes that adding 1 to nargs takes care of everything, including type code, etc. */ + nargs = Pop(); Push(Fast_Vector_Ref(Function, ENTITY_OPERATOR)); Push(nargs + 1); - /* No interrupts, etc. */ - goto Apply_Non_Trapping; + /* This must be done to prevent an infinite push loop by + an entity whose handler is the entity itself or some + other such loop. Of course, it will die if stack overflow + interrupts are disabled. + This will not work in fscheme! It has to be thought out + carefully. + */ + Stack_Check(Stack_Pointer); + goto Internal_Apply; } /* Interpret() continues on the next page */ diff --git a/v8/src/microcode/interp.c b/v8/src/microcode/interp.c index c542948f8..047d32f08 100644 --- a/v8/src/microcode/interp.c +++ b/v8/src/microcode/interp.c @@ -30,7 +30,7 @@ Technology nor of any adaptation thereof in any advertising, promotional, or sales literature without prior written consent from MIT in each case. */ -/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/interp.c,v 9.42 1988/03/23 18:31:25 jrm Exp $ +/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/interp.c,v 9.43 1988/03/23 18:45:39 jinx Rel $ * * This file contains the heart of the Scheme Scode * interpreter @@ -1375,11 +1375,19 @@ Perform_Application: /* This code assumes that adding 1 to nargs takes care of everything, including type code, etc. */ + nargs = Pop(); Push(Fast_Vector_Ref(Function, ENTITY_OPERATOR)); Push(nargs + 1); - /* No interrupts, etc. */ - goto Apply_Non_Trapping; + /* This must be done to prevent an infinite push loop by + an entity whose handler is the entity itself or some + other such loop. Of course, it will die if stack overflow + interrupts are disabled. + This will not work in fscheme! It has to be thought out + carefully. + */ + Stack_Check(Stack_Pointer); + goto Internal_Apply; } /* Interpret() continues on the next page */ -- 2.25.1