From owner-svn-src-head@FreeBSD.ORG Fri Jun 20 19:03:35 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 85137CDC for ; Fri, 20 Jun 2014 19:03:35 +0000 (UTC) Received: from nm19-vm0.bullet.mail.bf1.yahoo.com (nm19-vm0.bullet.mail.bf1.yahoo.com [98.139.213.162]) (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 252F82086 for ; Fri, 20 Jun 2014 19:03:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1403290633; bh=vSP9ldnywmgXDnZoPq1qcQTYi5SuenHiAPyVpcM9TUQ=; 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=EZx3q8dCsy2XIl26BphcDfIJFGW3E3NKbeHoZFSBcb62G7N8Vbq3+sqmpLWGvqxaVX40GvpjYtmSfqUo/z7dwWbyoLQ5eLDcr54OyMzkXXqYIcoy8TXubGs0B0GqQZsZ1nXNWCAxF25D+JcoNfsta0soQy4TwJLOlGAocCED/Vlufz7dSh9B4CRHTPOHLXwuT0fIbsAx5Oft5fQQXx6BXHUmURKVTwuYnGR5fXDjxkwAWMUQtGWjtMclsG0By7p155HQXlMNkgTHBKENMz2A3fx/K9N1FYi/TMKqIMIWJbnfDgobU90RcsscUkJBL5u6trTxhQmVp5vEQ81bsyNj9g== DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s2048; d=yahoo.com; b=uYkXha45/RkSjO2Pm8rK73mMLEkngr6hqz0ingCho1YEsEs0sHxCaQl//KkvJ4jL0DjUMvRObcjF70Tndj5ovC+vZlWrK2L/0U8vChQzkqMtpQjuAIDVmKYS5Xn8wyf8tqgv/8vtMPGI01rSRi0tdUnVK6cjHH14l1S6xCLpSoSQpn4MqL2MESoyQppJ9u8oHkTGMF5FyBMeUNSM+ybBNJ326TGhQRHMllu1JzNLRuXAbDZGDTocjNOgE5/gORbOJaa0r9/Y2QnKugl8uDrZZj6f/v19LfemqR5AcwDiX4x6Sfpf6VZpkfu90dsQQ4w6k0gtQL/nyLGRA2eX8UcUYQ==; Received: from [66.196.81.170] by nm19.bullet.mail.bf1.yahoo.com with NNFMP; 20 Jun 2014 18:57:13 -0000 Received: from [98.139.211.205] by tm16.bullet.mail.bf1.yahoo.com with NNFMP; 20 Jun 2014 18:57:13 -0000 Received: from [127.0.0.1] by smtp214.mail.bf1.yahoo.com with NNFMP; 20 Jun 2014 18:57:13 -0000 X-Yahoo-Newman-Id: 19013.92704.bm@smtp214.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: jrkjuFsVM1kCuY8knyFwoE2.lNxzcWN8m3Gmogcpkl3atOr qSbfYCld8gYRSzQaxOhcthMq2zLjzyg2h6BK2qzGKwkXHn.aUg59eBz2efnw fjH8LbTNehPOwubEOvOsQxITeN9Fa3D_4V.ClXWJOP8_BKmdHgqTfApwNu_E 1wBdecC.49BfewkIJT5WnOXQz9bz.wcu9Iw4wpt6AQ_sPcTwrcstZfG2X984 knd_G4G53Xo.EAPOHs8_CkglTIxmWqolkqfqvmEsPiJ1Z5ma6c0QFZRNyRX1 1i6wn7fGifFFd.2V.j5kiJ.tNcQ.mx4RmfgVL9mnAQqu1cbvA8NmwfW2FmwP TTS2GMDUxh1n3jilSJgb9HYMEprvpUduo183YArXBF2LaRICoL0pSA8ebTc5 sUzGylXjLqm607nBjMBjrr5Jcj5CY8ah0iEaxwfNietavAEktC7tJhd4PXOj PVwlZ5Hhc35ZbGRhY1qIeRNtj.tOy4pSEb5amzG54XQ_HZcJq.F2kiTvOpe4 ddLonnbzZlro.3bujQo7aje95M48G80mNPhRz9tasWSPkBja8eQOAQGZkApQ UjtztfLdrD7RT8.ObYMmvgq42oPux_2zAeHl.toCuG7HUnbWsop1tXFSMm.A KDDuzQbk- X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf X-Rocket-Received: from [192.168.0.102] (pfg@190.157.126.109 with plain [98.138.105.21]) by smtp214.mail.bf1.yahoo.com with SMTP; 20 Jun 2014 11:57:12 -0700 PDT Message-ID: <53A4840F.8030903@FreeBSD.org> Date: Fri, 20 Jun 2014 13:57:19 -0500 From: Pedro Giffuni Organization: FreeBSD User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Stefan Farfeleder Subject: Re: svn commit: r267675 - head/lib/libc/regex References: <201406201529.s5KFTAEB068038@svn.freebsd.org> <20140620182311.GA1214@mole.fafoe.narf.at> In-Reply-To: <20140620182311.GA1214@mole.fafoe.narf.at> 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 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jun 2014 19:03:35 -0000 El 6/20/2014 1:23 PM, Stefan Farfeleder escribió: > On Fri, Jun 20, 2014 at 03:29:10PM +0000, Pedro F. Giffuni wrote: >> Author: pfg >> Date: Fri Jun 20 15:29:09 2014 >> New Revision: 267675 >> URL: http://svnweb.freebsd.org/changeset/base/267675 >> >> Log: >> regex: Make use of reallocf(). >> >> Use of reallocf is useful in libraries as we are not certain the >> application will exit after NULL. >> >> This somewhat reduces portability but if since you are building >> this as part of libc it is likely you have our non-standard >> reallocf(3) already. >> >> Reviewed by: ache >> MFC after: 5 days >> >> Modified: >> head/lib/libc/regex/regcomp.c >> >> Modified: head/lib/libc/regex/regcomp.c >> ============================================================================== >> --- head/lib/libc/regex/regcomp.c Fri Jun 20 13:26:49 2014 (r267674) >> +++ head/lib/libc/regex/regcomp.c Fri Jun 20 15:29:09 2014 (r267675) >> @@ -1111,7 +1111,7 @@ allocset(struct parse *p) >> { >> cset *cs, *ncs; >> >> - ncs = realloc(p->g->sets, (p->g->ncsets + 1) * sizeof(*ncs)); >> + ncs = reallocf(p->g->sets, (p->g->ncsets + 1) * sizeof(*ncs)); >> if (ncs == NULL) { >> SETERROR(REG_ESPACE); >> return (NULL); >> @@ -1174,7 +1174,7 @@ CHadd(struct parse *p, cset *cs, wint_t >> if (ch < NC) >> cs->bmp[ch >> 3] |= 1 << (ch & 7); >> else { >> - newwides = realloc(cs->wides, (cs->nwides + 1) * >> + newwides = reallocf(cs->wides, (cs->nwides + 1) * >> sizeof(*cs->wides)); >> if (newwides == NULL) { >> SETERROR(REG_ESPACE); > > Hi Pedro, > > I don't think these changes are OK. If reallocf() fails here, the > cs->wides pointer will be freed and later freeset() will call > free(cs->wides), probably crashing. The other cases are most probably > similar though I haven't examined them closely. > Ugh .. I think you are right. Let me check and I will revert as necessary. Pedro.