unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* segfault on incorrect code
@ 2004-01-22 16:49 Alexandre Duret-Lutz
  2004-02-13  0:11 ` Marius Vollmer
  2004-02-14  0:07 ` Kevin Ryde
  0 siblings, 2 replies; 4+ messages in thread
From: Alexandre Duret-Lutz @ 2004-01-22 16:49 UTC (permalink / raw)


Seeing a thread named "core dump" remembered me an old bug I
stumbled upon years ago (in guile 1.3), but never reported. 
It seems to be still present in recent versions.

% guile
guile> (version)
"1.6.4"
guile> (define (foo a b c) (< b c))
guile> (sort '(3 2 1) foo)
zsh: segmentation fault  guile

The code is obviously wrong, but maybe sort could check the
arity of its last argument.
-- 
Alexandre Duret-Lutz



_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-guile


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: segfault on incorrect code
  2004-01-22 16:49 segfault on incorrect code Alexandre Duret-Lutz
@ 2004-02-13  0:11 ` Marius Vollmer
  2004-02-14  0:07 ` Kevin Ryde
  1 sibling, 0 replies; 4+ messages in thread
From: Marius Vollmer @ 2004-02-13  0:11 UTC (permalink / raw)
  Cc: bug-guile

Alexandre Duret-Lutz <Alexandre.Duret-Lutz@lip6.fr> writes:

> Seeing a thread named "core dump" remembered me an old bug I
> stumbled upon years ago (in guile 1.3), but never reported. 
> It seems to be still present in recent versions.

Fixed, thanks!

2004-02-13  Marius Vollmer  <mvo@zagadka.de>

	* sort.c (scm_cmp_function): Always return applyless, do not try
	to be clever.
	(subr2less, subr2oless, lsubrless, closureless): Removed.

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405


_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-guile


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: segfault on incorrect code
  2004-01-22 16:49 segfault on incorrect code Alexandre Duret-Lutz
  2004-02-13  0:11 ` Marius Vollmer
@ 2004-02-14  0:07 ` Kevin Ryde
  2004-02-14  0:33   ` Kevin Ryde
  1 sibling, 1 reply; 4+ messages in thread
From: Kevin Ryde @ 2004-02-14  0:07 UTC (permalink / raw)
  Cc: bug-guile

[-- Attachment #1: Type: text/plain, Size: 335 bytes --]

Alexandre Duret-Lutz <Alexandre.Duret-Lutz@lip6.fr> 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.


[-- Attachment #2: sort.c.formals.diff --]
[-- Type: text/plain, Size: 741 bytes --]

--- 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;
     }

[-- Attachment #3: Type: text/plain, Size: 136 bytes --]

_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-guile

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: segfault on incorrect code
  2004-02-14  0:07 ` Kevin Ryde
@ 2004-02-14  0:33   ` Kevin Ryde
  0 siblings, 0 replies; 4+ messages in thread
From: Kevin Ryde @ 2004-02-14  0:33 UTC (permalink / raw)
  Cc: Alexandre Duret-Lutz

Oops, I see I was beaten to it with a simpler approach.


_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-guile


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-02-14  0:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-22 16:49 segfault on incorrect code Alexandre Duret-Lutz
2004-02-13  0:11 ` Marius Vollmer
2004-02-14  0:07 ` Kevin Ryde
2004-02-14  0:33   ` Kevin Ryde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).