From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/392 Path: news.gmane.org!not-for-mail From: =?UTF-8?B?THVrYSBNYXLEjWV0acSH?= Newsgroups: gmane.linux.lib.musl.general Subject: Re: New daily reports - nothing Date: Wed, 10 Aug 2011 20:34:46 +0200 Message-ID: <4E42CF46.4090707@gmail.com> References: <20110807073224.GG132@brightrain.aerifal.cx> <4E3F10C7.4060601@gmail.com> <4E40A33F.7090804@gmail.com> <4E41E020.7020109@gmail.com> <20110810045933.GW132@brightrain.aerifal.cx> <4E427D34.4000905@gmail.com> <20110810142500.GX132@brightrain.aerifal.cx> <4E42BE37.4030805@gmail.com> <20110810173307.GZ132@brightrain.aerifal.cx> <4E42CCA9.50505@gmail.com> <20110810182115.GA132@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1313001434 27226 80.91.229.12 (10 Aug 2011 18:37:14 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 10 Aug 2011 18:37:14 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-393-gllmg-musl=m.gmane.org@lists.openwall.com Wed Aug 10 20:37:09 2011 Return-path: Envelope-to: gllmg-musl@lo.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by lo.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1QrDeP-0004OR-By for gllmg-musl@lo.gmane.org; Wed, 10 Aug 2011 20:37:09 +0200 Original-Received: (qmail 28010 invoked by uid 550); 10 Aug 2011 18:37:09 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 28002 invoked from network); 10 Aug 2011 18:37:08 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=61WCqdBhi11EOI8zWskiaRl+6Yt79cTpTjr5VN+b1xY=; b=pBexX8SYReoW1M7sBIF4TSU6tSDzDxnK/6PEATlEUJkkjC1sYjc631xRmA6pg2ZYK2 KjUBwjo2lCrVpt5Vkt7buZtxcw44/rfWfgTNB0BvjYZ/DQKJ12ZlwcHV1px0PymCgL9W nd+xZdB4WgABQQlHu/fCkxaqRp0p0NPn5kME0= User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110626 Icedove/3.1.11 In-Reply-To: <20110810182115.GA132@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:392 Archived-At: On 08/10/2011 08:21 PM, Rich Felker wrote: > On Wed, Aug 10, 2011 at 08:23:37PM +0200, Luka Marčetić wrote: >> On 08/10/2011 07:33 PM, Rich Felker wrote: >>> What about SIZE_MAX>>(4*sizeof(size_t))? >> Never heard of it. What about PTRDIFF_MAX though? > My point was that SIZE_MAX>>(4*sizeof(size_t)) is an easy way to get > the square root of SIZE_MAX without long double arithmetic. Doesn't seem that easy to me. > PTRDIFF_T > is rather irrelevant to testing calloc overflows, where the whole > point is that A*B overflows SIZE_MAX and results in a small integer > value where the allocation will certainly succeed. The task says I should test for PTRDIFF_T. So i tried to make a general function.