GNU bug report logs - #18361
New 'sort' implementation can crash Emacs

Previous Next

Package: emacs;

Reported by: Paul Eggert <eggert <at> cs.ucla.edu>

Date: Fri, 29 Aug 2014 21:26:01 UTC

Severity: minor

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: bug-emacs <bug-gnu-emacs <at> gnu.org>, 
 Dmitry Antipov <dmantipov <at> yandex.ru>
Subject: New 'sort' implementation can crash Emacs
Date: Fri, 29 Aug 2014 14:24:53 -0700
The new implementation of 'sort' in the trunk invokes qsort (or 
qsort_r), but these functions have undefined behavior if the comparison 
function is ill-behaved.  Since the comparison predicate is 
user-defined, this means a bad user-supplied comparison function could 
crash Emacs.

One possible fix would be to build on the proposed patch in Bug#18360, 
except to change Emacs to always define its own qsort_r substitute, one 
that is known to produce some permutation of the input without crashing 
even if the comparison function is ill-behaved.




This bug report was last modified 10 years and 347 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.