From owner-svn-src-all@FreeBSD.ORG Mon May 5 22:17:36 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 52849EC7 for ; Mon, 5 May 2014 22:17:36 +0000 (UTC) Received: from nm43-vm8.bullet.mail.bf1.yahoo.com (nm43-vm8.bullet.mail.bf1.yahoo.com [216.109.114.239]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CCF7EBD2 for ; Mon, 5 May 2014 22:17:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1399327858; bh=8V9SDt6K1+kstkRWZ0DfiOqLScphesFdbZtI4R18f/8=; h=Received:Received:Received:X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:X-Rocket-Received:Message-ID:Date:From:Organization:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=XmdaNkRz8bkMi8pEsrLvu1FmUStzsif5U/6WsD9gTo5+eOFO1NH6gzIdN8xnKiXnObn2DjKA7DazlsxPU/XgGkLK0YiNb+bE/cdC41ijt4UDdCokb7Coxk8r1z/jC/DT8oj9pwEJ3UjRD6NXo1w48ZgEn+OqQVKqQ0Lz/gKkqmF7o0NUst8JeaiO1hzLKFEROLehL94XRyBORqRtYMnoND5qHqady1PXsmYbf0TsH4QHaFWWRva4nsLAi+a+3DmCzrFn5I8iUN9/Sm7n1k+fWumJiEc0DGXJt47rkzB54Pyfmook3bKwWyh6VpQ2qtC6NUrbBC7UGdwKkePwhLKngA== DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s2048; d=yahoo.com; b=rJ755XPjg/s/DW2qEPYPT0k5ZugOQ6shuL7HsuR5jkRh3CPGuMGKt+srptp50ces1DZBE0+UN1RWN8/Y34Z94aCAL/g6wbwLO6PmrgI99RcPbTzKlPpK4Ho6qbJTIU8W3SfPHynI850sXnZovbo246X/7LiKqd5YN9uUgd+ij/pzGrr16dSjaTmQChDXHYKgwGs8COMfltYAXMhKjaH333FF0YFuxVAO/Q9Ov9SKamTh/jC67s+VhJmj1XPnwWbYim8+drW3vA3Spb/81iwzweZjXhtHE3Hk44O5uRSZp4h2R+kCkbSsv+6DaDqPygCqk1gqCCYVnWoEH+QuhY6fkg==; Received: from [66.196.81.172] by nm43.bullet.mail.bf1.yahoo.com with NNFMP; 05 May 2014 22:10:58 -0000 Received: from [68.142.230.73] by tm18.bullet.mail.bf1.yahoo.com with NNFMP; 05 May 2014 22:10:58 -0000 Received: from [127.0.0.1] by smtp230.mail.bf1.yahoo.com with NNFMP; 05 May 2014 22:10:58 -0000 X-Yahoo-Newman-Id: 71619.44312.bm@smtp230.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: zU4kFMgVM1mUiRtpFXlcsGxwBq7zNQ8AbzlbdX8uZtsto1d 2Gq8Hh7u48QJDWctRrgmyPpufZzO0rXdZMJusY0RyEmNuiVHRmC9VGp1cH57 3izFdinU.zSSjZSXXJD8RY6hJAW3PA.ob4lylnTLKLA4JI7hotH5unhfEqC. B7U_qZ9kxHDbcL5bWp4RW57m9ZDmnhlw85VEI0SIbBnUZQAnGOLPxNq9hS7I fYgzMLBJIEQCohFwiMUYuxIJnxXUaYIWRcND_apdWzjf43BNlhWCjGffjFWX pUQ9.gHb3xfdngZMftfrR.Furxj1aXr31JecYJGQmMR80ewgr_.kJst3LN4n 39EJk9fhgiux.2oV9CwTfHi1rcyoixKM8GIyZKExjOYKURMpJJjvAF7JaK3. 1FMnlZIeRD.wfCn6j8mOJzgeQKgLZQQuoxrrXX6N2TaShE8UsLmgWQZ94AcS 9wMsEQQB_K5l5FsVuYu1.4pwB7dKzAaJA0NKzjOmwjQtSrY7E3tXuCoJxaii BP67vtTqsZefz29prC5vKrwc2uo0- X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf X-Rocket-Received: from [192.168.0.102] (pfg@190.157.126.109 with plain [98.139.211.125]) by smtp230.mail.bf1.yahoo.com with SMTP; 05 May 2014 22:10:58 +0000 UTC Message-ID: <53680C72.10809@FreeBSD.org> Date: Mon, 05 May 2014 17:10:58 -0500 From: Pedro Giffuni Organization: FreeBSD User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: David Chisnall Subject: Re: svn commit: r265367 - head/lib/libc/regex References: <201405051641.s45GfFje086423@svn.freebsd.org> <5367CD77.40909@freebsd.org> <5367EB54.1080109@FreeBSD.org> <3C7CFFB7-5C84-4AC1-9A81-C718D184E87B@FreeBSD.org> In-Reply-To: <3C7CFFB7-5C84-4AC1-9A81-C718D184E87B@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andrey Chernov X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 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, 05 May 2014 22:17:36 -0000 El 5/5/2014 4:21 PM, David Chisnall escribió: > On 5 May 2014, at 20:49, Pedro Giffuni wrote: > >> Yes, but I reverted it because there are other ways to check for overflows without the performance hit. > FWIW, in this particular case I think the overflow simply doesn't happen: apparently it is easier to be hit by a DoS first. > Do we have a good reusable routine for doing this somewhere? Clang and gcc both have some idiom recognisers that try to spot when people are attempting to do this. Clang also has a builtin, which would be good to use when available. Overflow checking is very cheap on modern CPUs (add, branch on carry), so it would be nice if we could start looking for this malloc() and realloc() pattern and replacing the multiply with something that checks for the error. > We don't. OpenBSD introduced an extension: reallocarray(). Pedro.