From 2197dfd15065260002b55a8ea746196ba22ad094 Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Mon, 5 May 2014 19:26:44 -0700 Subject: [PATCH] Fix continue_from_trap to NOT open a FREE_PARANOIA_MARGIN hole. Just reset Free to heap_alloc_limit if its sanity check fails. --- src/microcode/uxtrap.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/microcode/uxtrap.c b/src/microcode/uxtrap.c index d1eb80767..bf9d45636 100644 --- a/src/microcode/uxtrap.c +++ b/src/microcode/uxtrap.c @@ -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) = -- 2.25.1