From nobody Wed Nov 08 01:00:37 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SQ6Fx3gw5z4yxXx; Wed, 8 Nov 2023 01:00:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SQ6Fx30HFz3TJr; Wed, 8 Nov 2023 01:00:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699405237; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eUtFFR9LfJmZGQmMknwrFJTA749tTL1d/FOB3elhWf0=; b=ABu0gyotDL4QEWFYKXnu8d+23WaOuds5qd+GjBl69fJyXkDIFIicamIJX0MfEBnug9c9VJ RTSSEXve/nDUcSKoKEkXoxUFt9R3ShKFx/sO3ogl6jMNIcip6pOx0tZOXo7ygxzNAvx9xN pinc4QkqBg8HSFsTAAry90J9QrrrVKTAAZsUXcd0HHUZdv3vRWz3j0zd6not1j5N842Nzz rkoLAHvHiI+URYbjO17TGv3RyjjSfNQee9a5IEfplngzZXPV7aowf4HuxSVf2Ttz0to4el kkUCB2IlJPjNdC6oCkVvb0yV5nuNcfatlj/L+xP2r2fDgSOs44gMW/jqXA9YFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699405237; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eUtFFR9LfJmZGQmMknwrFJTA749tTL1d/FOB3elhWf0=; b=Rm4UtnVc8tTXcym2rnCi/mrK4UU2iBVrJtwRV9NuLXSXxDzeGMro5Z2V8Ufi0JJCD+1AxO 6erEmt0V8s+LUc36VE+PeBHJ9jSCCVRlQoR11cvlVEGB4NSwE7hKIrbJQGbmNCWd+OBlbl MxdieQAXn3VGCRQMtnNrvGpAC1OE5pZNeAzajBHW6HaQJoYeNvSQM2oIQnbzghTJpfDf+f mYeIH7Elwjys6s2l3ASYZrsfFstGjBozxNQ0Q4pBUfDoEPdKYeuI2fzRgLAcRGOykkqUcR yXHqqXF+Zk2fshtEpRn1pPaAOElg3e8sKR7p0QEGllt/7u5PPGyGkOsWV+iYlw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1699405237; a=rsa-sha256; cv=none; b=Oj1q0UBAuEOeQDrPMaS8pfNOoGNBDYx1teYVb+2uSSDw5uYqm9jQn3DL7OEXe6pfpVG8Sz BO/326tSLZd43mA5WoPBtQXFhS0jd8erqvPKP+futxHgPq+YYoW3RHMeRnsx6yVudUYUQG 3MgVjJNOWngmrnVutMAcm9HHePmd/iO01hvKzdHxTCyfzHvK2IBRGVoeSsgx1iVAhcEGdH rQaTGI1vYwLBT1zADypkVVsKcWpbo0ISarpBhr2Rcz/tVRgeVPN/U4owtGeol9SDKDKGFp B+zCyhUCGx3fUh2kOwSQJRNrpjoTrvHuPUpFtr7zA0lRmZSCMlc/K69CyOnMKQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SQ6Fx1zCsz1BRV; Wed, 8 Nov 2023 01:00:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3A810bKm099152; Wed, 8 Nov 2023 01:00:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3A810b03099149; Wed, 8 Nov 2023 01:00:37 GMT (envelope-from git) Date: Wed, 8 Nov 2023 01:00:37 GMT Message-Id: <202311080100.3A810b03099149@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 67264bfe4992 - releng/13.2 - regcomp: use unsigned char when testing for escapes List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 67264bfe499223cd9864b53975462e3eb57cde2c Auto-Submitted: auto-generated The branch releng/13.2 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=67264bfe499223cd9864b53975462e3eb57cde2c commit 67264bfe499223cd9864b53975462e3eb57cde2c Author: Christos Zoulas AuthorDate: 2023-08-30 20:37:24 +0000 Commit: Ed Maste CommitDate: 2023-11-08 00:59:51 +0000 regcomp: use unsigned char when testing for escapes - cast GETNEXT to unsigned where it is being promoted to int to prevent sign-extension (really it would have been better for PEEK*() and GETNEXT() to return unsigned char; this would have removed a ton of (uch) casts, but it is too intrusive for now). - fix an isalpha that should have been iswalpha PR: 264275, 274032 Reviewed by: kevans, eugen (previous version) Obtained from: NetBSD (cherry picked from commit 3fb80f1476c7776f04ba7ef6d08397cef6abcfb0) (cherry picked from commit ac695744e2cfb461a64018276fb94999fb0cad9c) Approved by: so Security: FreeBSD-EN-23:14 --- lib/libc/regex/regcomp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/libc/regex/regcomp.c b/lib/libc/regex/regcomp.c index 970a448b649a..bdc1c3379fd3 100644 --- a/lib/libc/regex/regcomp.c +++ b/lib/libc/regex/regcomp.c @@ -830,10 +830,10 @@ p_simp_re(struct parse *p, struct branchc *bc) handled = false; assert(MORE()); /* caller should have ensured this */ - c = GETNEXT(); + c = (uch)GETNEXT(); if (c == '\\') { (void)REQUIRE(MORE(), REG_EESCAPE); - cc = GETNEXT(); + cc = (uch)GETNEXT(); c = BACKSL | cc; #ifdef LIBREGEX if (p->gnuext) { @@ -994,7 +994,7 @@ p_count(struct parse *p) int ndigits = 0; while (MORE() && isdigit((uch)PEEK()) && count <= DUPMAX) { - count = count*10 + (GETNEXT() - '0'); + count = count*10 + ((uch)GETNEXT() - '0'); ndigits++; } @@ -1304,7 +1304,7 @@ may_escape(struct parse *p, const wint_t ch) if ((p->pflags & PFLAG_LEGACY_ESC) != 0) return (true); - if (isalpha(ch) || ch == '\'' || ch == '`') + if (iswalpha(ch) || ch == '\'' || ch == '`') return (false); return (true); #ifdef NOTYET