bug-guile
[Top][All Lists]
Advanced

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

Re: segfault on incorrect code


From: Kevin Ryde
Subject: Re: segfault on incorrect code
Date: Sat, 14 Feb 2004 10:07:29 +1000
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3 (gnu/linux)

Alexandre Duret-Lutz <address@hidden> writes:
>
> guile> (define (foo a b c) (< b c))
> guile> (sort '(3 2 1) foo)

Thanks.

I get some joy from the change below, but someone smarter than me will
need to verify that it's the right approach.  The "if" conditions are
cut and pasted from scm_trampoline_2 in the cvs head.

--- sort.c.~1.36.2.4.~  2002-03-15 20:33:37.000000000 +1000
+++ sort.c      2004-02-13 09:38:23.000000000 +1000
@@ -401,7 +401,18 @@
     case scm_tc7_lsubr:
       return lsubrless;
     case scm_tcs_closures:
-      return closureless;
+      {
+       SCM formals = SCM_CLOSURE_FORMALS (p);
+        if (!SCM_NULLP (formals)
+            && (!SCM_CONSP (formals)
+                || (!SCM_NULLP (SCM_CDR (formals))
+                    && (!SCM_CONSP (SCM_CDR (formals))
+                        || !SCM_CONSP (SCM_CDDR (formals))))))
+          return closureless;
+      }
+      /* invalid formal parameters, return applyless and let scm_call_2
+         there report the error */
+      /*FALLTHRU*/
     default:
       return applyless;
     }

reply via email to

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