Fix continue_from_trap to NOT open a FREE_PARANOIA_MARGIN hole.
authorMatt Birkholz <puck@birchwood-abbey.net>
Tue, 6 May 2014 02:26:44 +0000 (19:26 -0700)
committerMatt Birkholz <puck@birchwood-abbey.net>
Tue, 6 May 2014 02:26:44 +0000 (19:26 -0700)
Just reset Free to heap_alloc_limit if its sanity check fails.

src/microcode/uxtrap.c

index d1eb80767dd15ddfbc0005ca3ad75d9e71808fbe..bf9d456364e821acb8c9c5088a1c7a14167c418e 100644 (file)
@@ -329,7 +329,6 @@ trap_handler (const char * message,
       display more information. */
 
 #define SCHEME_ALIGNMENT_MASK ((sizeof (SCHEME_OBJECT)) - 1)
-#define FREE_PARANOIA_MARGIN 0x100
 
 #define ALIGNED_P(addr)                                                        \
   ((((unsigned long) (addr)) & SCHEME_ALIGNMENT_MASK) == 0)
@@ -405,19 +404,16 @@ continue_from_trap (int signo, SIGINFO_T info, SIGCONTEXT_T * scp)
     new_sp = 0;
 
   /* Sanity-check Free.  */
-  if ((new_sp != 0)
-      && (ADDRESS_IN_HEAP_P (Free))
-      && (ALIGNED_P (Free)))
+  if (!((new_sp != 0)
+       && (ADDRESS_IN_HEAP_P (Free))
+       && (ALIGNED_P (Free))))
     {
-      if (FREE_OK_P (Free))
-       {
-         Free += FREE_PARANOIA_MARGIN;
-         if (!FREE_OK_P (Free))
-           Free = heap_alloc_limit;
-       }
+#ifdef ENABLE_DEBUGGING_TOOLS
+      outf_error ("Resetting bogus Free in continue_from_trap.\n");
+      outf_flush_error ();
+#endif
+      Free = heap_alloc_limit;
     }
-  else
-    Free = heap_alloc_limit;
 
   /* Encode the registers.  */
   (recovery_info . extra_trap_info) =