From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/9078 Path: news.gmane.org!not-for-mail From: Alexander Monakov Newsgroups: gmane.linux.lib.musl.general Subject: Re: Possible infinite loop in qsort() Date: Sun, 10 Jan 2016 14:38:05 +0300 (MSK) Message-ID: References: <20160109082139.GD2016@debian> <20160109090719.GA385@nyan> <20160110040516.GQ238@brightrain.aerifal.cx> 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 1452425903 20911 80.91.229.3 (10 Jan 2016 11:38:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 10 Jan 2016 11:38:23 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-9091-gllmg-musl=m.gmane.org@lists.openwall.com Sun Jan 10 12:38:23 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 1aIEKC-0002z8-FX for gllmg-musl@m.gmane.org; Sun, 10 Jan 2016 12:38:20 +0100 Original-Received: (qmail 13997 invoked by uid 550); 10 Jan 2016 11:38:17 -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 13976 invoked from network); 10 Jan 2016 11:38:16 -0000 In-Reply-To: <20160110040516.GQ238@brightrain.aerifal.cx> User-Agent: Alpine 2.20 (LNX 67 2015-01-07) Xref: news.gmane.org gmane.linux.lib.musl.general:9078 Archived-At: On Sat, 9 Jan 2016, Rich Felker wrote: > Note also that if you do want to use this code on an implementation > without such a guarantee, only the case where the member size is 1 can > possibly have >SIZE_MAX/2 members. I don't think so: the problematic loop in musl computes Leonardo numbers premultiplied by member size, to be used as byte offsets in the array to be sorted. So individual member size doesn't matter, only the overall array size. Alexander