From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28254 invoked by alias); 2 Aug 2002 09:56:11 -0000 Mailing-List: contact libc-hacker-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sources.redhat.com Received: (qmail 28236 invoked from network); 2 Aug 2002 09:56:10 -0000 Received: from unknown (HELO sunsite.mff.cuni.cz) (195.113.19.66) by sources.redhat.com with SMTP; 2 Aug 2002 09:56:10 -0000 Received: (from jakub@localhost) by sunsite.mff.cuni.cz (8.11.6/8.11.6) id g729t6112473; Fri, 2 Aug 2002 11:55:06 +0200 Date: Fri, 02 Aug 2002 02:56:00 -0000 From: Jakub Jelinek To: Ulrich Drepper Cc: Wolfram Gloger , libc-hacker@sources.redhat.com Subject: Re: [PATCH] xdr_array and calloc security fix Message-ID: <20020802115506.C20867@sunsite.ms.mff.cuni.cz> Reply-To: Jakub Jelinek References: <20020802004635.Y20867@sunsite.ms.mff.cuni.cz> <20020802092945.24679.qmail@md.dent.med.uni-muenchen.de> <3D4A5446.5030204@redhat.com> <3D4A55F0.5020007@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <3D4A55F0.5020007@redhat.com>; from drepper@redhat.com on Fri, Aug 02, 2002 at 02:50:40AM -0700 X-SW-Source: 2002-08/txt/msg00016.txt.bz2 On Fri, Aug 02, 2002 at 02:50:40AM -0700, Ulrich Drepper wrote: > Ulrich Drepper wrote: > > > It should be possible to have something like > > > > ((a | b) > (a * b)) > > > > for unsigned values. I'm not 100% sure, though. > > I mean, this is an approximation which lets us avoid the division in > many (most?) cases. Many. a=1 b=2 -> is this overflow? a=0x6000000 b=64 -> this would signal no overflow, while in fact it overflowed. Etc. I think the only way is to put the multiply + check for overflow into some macro and optimize it per-architecture... Jakub