Ivan Shcherbakov <[email protected]> writes:

> 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.

That all makes sense, but are you seeing this problem in practice?

Thanks,
        Neil


Reply via email to