bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#18361: New 'sort' implementation can crash Emacs


From: Dmitry Antipov
Subject: bug#18361: New 'sort' implementation can crash Emacs
Date: Sat, 30 Aug 2014 10:55:17 +0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0

On 08/30/2014 09:22 AM, Paul Eggert wrote:

See, for example,

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42157
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51297

Very nice.  But couldn't we detect an improper comparison
function at runtime?  For example:

=== modified file 'src/fns.c'
--- src/fns.c   2014-08-29 19:18:06 +0000
+++ src/fns.c   2014-08-30 06:52:20 +0000
@@ -1933,6 +1933,8 @@
      preserve original order.  Pretty ugly but works.  */
   more = NILP (call2 (sort_vector_predicate, vp, vq));
   less = NILP (call2 (sort_vector_predicate, vq, vp));
+  if (!more && !less)
+    error ("Not an anti-symmetrical predicate in sort");
   return ((more && !less) ? 1
          : ((!more && less) ? -1
             : XSAVE_INTEGER (op, 0) - XSAVE_INTEGER (oq, 0)));

Dmitry






reply via email to

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