From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15951 invoked by alias); 13 Aug 2017 21:12:30 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 41540 Received: (qmail 1607 invoked by uid 1010); 13 Aug 2017 21:12:30 -0000 X-Qmail-Scanner-Diagnostics: from mx.spodhuis.org by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(94.142.241.89):SA:0(-2.3/5.0):. Processed in 1.298621 secs); 13 Aug 2017 21:12:30 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: zsh-workers+phil.pennock@spodhuis.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=spodhuis.org; s=d201708; h=In-Reply-To:Content-Type:MIME-Version:References :Message-ID:Subject:To:From:Date:Sender:Reply-To:Cc:Content-Transfer-Encoding :Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=AC3pOud39lMKXAYNchupxzj4L3KI3qHk7mvFTDMLxkA=; b=ZNPiAz4dmCETVaTCl8sYe3eBgu UWxb3m1jpRMSEYOoI/MjUAAFWwRIKSFS5/gSryZJt8IiKHFN4+aIxoRRxl1NW19rIRlAgCVT3GszL Is7UxBAOsjOrJlJknKlNIHeueg/Ev/PR9lRyVJZ8KxyU3hM7uWMsyp8yxDHGCY+qK2AX0ePM+y+gU 2UjE6/qM5g1Kk3eHoP/c+w+zLZsI; Date: Sun, 13 Aug 2017 17:12:25 -0400 From: Phil Pennock To: zsh-workers@zsh.org Subject: Re: 5.4.1 regression: PCRE with bash_rematch Message-ID: <20170813211225.GB98824@tower.spodhuis.org> References: <20170813204949.GA98824@tower.spodhuis.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170813204949.GA98824@tower.spodhuis.org> OpenPGP: url=https://www.security.spodhuis.org/PGP/keys/0x4D1E900E14C1CC04.asc On 2017-08-13 at 16:49 -0400, Phil Pennock wrote: > I'm still trying to track this down, but getting what I have out there > because in checking just now, I saw that a 5.4.2 might be imminent and I > think this should block. Definitely; this is a regression from my NUL fixing and trying to correctly meta/unmeta all parameters going through. Change 41308 in commit 825f84c77 exposed a bug introduced in 2011 in commit 2f3c16d40f. > % /opt/zsh-devel/bin/zsh -f > osmium% setopt bash_rematch > osmium% zmodload zsh/pcre > osmium% [[ "server" -pcre-match ^[^@:/]+$ ]] 186 if (!want_begin_end || nelem) { 187 char **x, **y; 188 int vec_off; 189 y = &captures[capture_start]; 190 matches = x = (char **) zalloc(sizeof(char *) * (arrlen(y) + 1)); 191 vec_off = 2; 192 do { 193 if (*y) 194 *x++ = metafy(*y, ovec[vec_off+1]-ovec[vec_off], META_DUP); 195 else 196 *x++ = NULL; 197 vec_off += 2; 198 } while (*y++); 199 setaparam(substravar, matches); 200 } We hit problems in line 194, we're capturing for sub-expressions, but there are no sub-expressions. We have a regexp with no sub-captures but through the bash_rematch path we're hitting this which assumes that we are.