From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/9097 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: Possible infinite loop in qsort() Date: Tue, 12 Jan 2016 13:48:55 +0100 Message-ID: <20160112124855.GB13558@port70.net> References: <20160109082139.GD2016@debian> <20160109090719.GA385@nyan> <20160110040516.GQ238@brightrain.aerifal.cx> <20160110113852.GE2016@debian> <5694F0D5.8080709@openwall.com> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1452602958 20035 80.91.229.3 (12 Jan 2016 12:49:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 12 Jan 2016 12:49:18 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-9110-gllmg-musl=m.gmane.org@lists.openwall.com Tue Jan 12 13:49:11 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1aIyNq-0005pU-3x for gllmg-musl@m.gmane.org; Tue, 12 Jan 2016 13:49:10 +0100 Original-Received: (qmail 22026 invoked by uid 550); 12 Jan 2016 12:49:07 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 22008 invoked from network); 12 Jan 2016 12:49:07 -0000 Mail-Followup-To: musl@lists.openwall.com Content-Disposition: inline In-Reply-To: <5694F0D5.8080709@openwall.com> User-Agent: Mutt/1.5.24 (2015-08-30) Xref: news.gmane.org gmane.linux.lib.musl.general:9097 Archived-At: * Alexander Cherepanov [2016-01-12 15:25:57 +0300]: > On 2016-01-10 14:38, Markus Wichmann wrote: > >On Sat, Jan 09, 2016 at 11:05:16PM -0500, Rich Felker wrote: > >>On Sat, Jan 09, 2016 at 10:07:19AM +0100, Felix Janda wrote: > >>>musl enforces that object sizes should not be greater than PTRDIFF_MAX. > >>>See for example the discussion at > >>> > >>>http://www.openwall.com/lists/musl/2013/06/27/7 > >>> > >>>So there will not be objects of size 3GB with musl on x32. Since the > >>>Leonardo numbers grow slower than 2^n in general no overflow should > >>>happen if "size" is valid. Otherwise, UB was invoked. > >> > > > >OK. Might want to make that assumption a bit more prominent, because > >this is the first time I've ever heard about it, but OK, no objects >2GB > >on 32-bit archs. > > Yeah, I don't see it in the doc. Did I miss it? > > If it neither works nor documented as a limit I'd call it a bug. in musl things are documented in the git log for now, e.g.: http://git.musl-libc.org/cgit/musl/commit/?id=3cd6f5229f079f892411e82fce3fe15c78eef4d8 i think if an implementation does not give this guarantee that should be considered a bug. (glibc does not guarantee this and indeed it is full of invalid pointer arithmetics, but more importantly a huge number of existing libraries depend on this) > BTW the support in compilers for working with objects larger than half the > address space is buggy -- see > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67999 . The same situation -- > it neither works nor documented. Somewhat puzzling... yes, but it's not possible to support reasonably