bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug in stackchk.h


From: Ivan Shcherbakov
Subject: bug in stackchk.h
Date: Wed, 6 Jan 2010 22:37:38 +0100

Hi, All,
 
There  is  a  bug  in  libguile/stackchk.h  file.  In some cases, when
integer  value of the stack pointer is less than stack checking limit,
false positives are produced.

The following code is responsible for the problem:
#  define SCM_STACK_OVERFLOW_P(s)\
   (SCM_STACK_PTR (s) \
    < (SCM_I_CURRENT_THREAD->base - SCM_STACK_LIMIT))

When SCM_I_CURRENT_THREAD->base < SCM_STACK_LIMIT holds,
the  last  part  of  the exception produces an overflow and the entire
expression holds even when no stack overflow occurs.

To fix the problem, the SCM_STACK_OVERFLOW() should be replaced by the
following one:

#  define SCM_STACK_OVERFLOW_P(s)\
   ((SCM_I_CURRENT_THREAD->base - SCM_STACK_PTR (s)) \
    > SCM_STACK_LIMIT)

This  ensures  that  the  difference  between  the  stack base and the
examined   local   variable   address  is  always  computed  correctly
regardless the integer value of the stack pointer.

-- 
Best Regards,
 Ivan Shcherbakov                     mailto:address@hidden
 TU Kaiserslautern, Germany
 Department of Real-Time Systems





reply via email to

[Prev in Thread] Current Thread [Next in Thread]