Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 05 May 2014 14:49:40 -0500
From:      Pedro Giffuni <pfg@FreeBSD.org>
To:        David Chisnall <theraven@FreeBSD.org>, Andrey Chernov <ache@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r265367 - head/lib/libc/regex
Message-ID:  <5367EB54.1080109@FreeBSD.org>
In-Reply-To: <B11B5B25-8E05-4225-93D5-3A607332F19A@FreeBSD.org>
References:  <201405051641.s45GfFje086423@svn.freebsd.org> <5367CD77.40909@freebsd.org> <B11B5B25-8E05-4225-93D5-3A607332F19A@FreeBSD.org>

index | next in thread | previous in thread | raw e-mail

El 5/5/2014 1:28 PM, David Chisnall escribió:
> On 5 May 2014, at 18:42, Andrey Chernov <ache@freebsd.org> wrote:
>
>> Please don't commit OpenBSD errors. Now you mix calloc() with the
>> realloc() for the same variable later which makes calloc() zeroing
>> pointless and waste of CPU.
>
> The purpose of calloc() here is not (primarily) to get the zero'd size, it's to get the overflow-checking behaviour for calloc.
>

Yes, but I reverted it because there are other ways to check for 
overflows without the performance hit.

> The uses of realloc() later do still potentially overflow, as they follow the realloc(pointer, size * sizeof(type)) antipattern.
>

FWIW, I actually got to this by checking kern/169302: unfortunately it 
is unclear if the NetBSD patch there (with or without the OpenBSD 
change) helps with the test case.

Pedro.




help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5367EB54.1080109>