Add some overflow checking in entity apply code. It will not work in
authorGuillermo J. Rozas <edu/mit/csail/zurich/gjr>
Wed, 23 Mar 1988 18:45:39 +0000 (18:45 +0000)
committerGuillermo J. Rozas <edu/mit/csail/zurich/gjr>
Wed, 23 Mar 1988 18:45:39 +0000 (18:45 +0000)
fscheme/multischeme, but figuring out what the right thing to do there
is not easy.

v7/src/microcode/interp.c
v8/src/microcode/interp.c

index 0ce0040a5345954faa106fce879b0207737bf5c2..2c88b54638d5ad2ecf83a3e6d7a3b04da29a52d1 100644 (file)
@@ -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 */
index c542948f86f9274a1c5c25787c8e75595eece4df..047d32f08b7cf2765206219581ab29354d55849c 100644 (file)
@@ -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 */