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 #17 received at 18361 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Dmitry Antipov <dmantipov <at> yandex.ru>
Cc: 18361 <at> debbugs.gnu.org
Subject: Re: bug#18361: New 'sort' implementation can crash Emacs
Date: Fri, 29 Aug 2014 22:22:48 -0700
Dmitry Antipov wrote:
>
> If an undefined behavior doesn't cause crash,

Unfortunately undefined behavior in qsort can cause a crash (or an 
infinite loop, etc., etc.).  It's platform-dependent, and on many 
platforms the problem happens only in unusual cases, so I'm not 
surprised your tests didn't find it.  But it definitely can happen. 
See, for example,

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

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

These crash reports are for Solaris qsort, but today I found similar 
issues in the latest glibc qsort by code inspection (e.g., the path 
qsort takes when memory is low).  These issues are not qsort bugs, since 
the qsort spec requires a total-order comparison function.  It's a bug 
in the Emacs trunk.




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.