From owner-svn-src-all@FreeBSD.ORG Mon Jan 11 14:27:40 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C7A84106566B for ; Mon, 11 Jan 2010 14:27:40 +0000 (UTC) (envelope-from joerg@britannica.bec.de) Received: from www.sonnenberger.org (www.sonnenberger.org [92.79.50.50]) by mx1.freebsd.org (Postfix) with ESMTP id 85B768FC13 for ; Mon, 11 Jan 2010 14:27:40 +0000 (UTC) Received: from britannica.bec.de (www.sonnenberger.org [192.168.1.10]) by www.sonnenberger.org (Postfix) with ESMTP id DB4C9667DF for ; Mon, 11 Jan 2010 15:11:40 +0100 (CET) Received: by britannica.bec.de (Postfix, from userid 1000) id A6DB115C51; Mon, 11 Jan 2010 15:12:35 +0100 (CET) Date: Mon, 11 Jan 2010 15:12:35 +0100 From: Joerg Sonnenberger To: svn-src-all@freebsd.org Message-ID: <20100111141235.GE12281@britannica.bec.de> References: <201001101430.o0AEUURS051917@svn.freebsd.org> <20100110212548.GA47331@nagual.pp.ru> <4B4A5252.9070205@freebsd.org> <20100111134429.F1302@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100111134429.F1302@besplex.bde.org> User-Agent: Mutt/1.5.20 (2009-06-14) Subject: Re: svn commit: r201999 - head/lib/libc/stdio X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jan 2010 14:27:40 -0000 On Mon, Jan 11, 2010 at 02:29:03PM +1100, Bruce Evans wrote: > calloc() has the same overflow bug, if any. Standards seem to require > fread and calloc to work even if the multiplication would occur, though > they cannot work in most cases where the multiplication would occur, > even if the overflow is avoided. Well, calloc on any BSD supported architecture can not allocate more than SIZE_MAX (or SIZE_MAX itself). There is an error defined for that. fread and fwrite will access invalid addressses, so doing nothing would be a correct implementation of "undefined". Cutting it off at SIZE_MAX/size seems silly as it would give the same behavior. Frankly, I would just back this out and let the application hit the wall... Joerg