From nobody Sat Sep 30 02:52:15 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 4RyBZl63gsz4v94m; Sat, 30 Sep 2023 02:52:15 +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 4RyBZl3jL9z4XT3; Sat, 30 Sep 2023 02:52:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696042335; 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=Po9DONmHAe8MSLs5xnlSKareB4phi7gksX7nqlKf/OA=; b=oX/HNaS/Cw4aR4gvdotvA64imlyjPpBvzwNirDGd6V5wjhw162NKIhQrNFEuRi5odqpFII owwAE2f27S5aIBhn4KlOm2tS3eyTAMPzraMYYY+lTYCjIhmpXl/VcI2SxBLjt19t3WXhUA g1DZrj7qk6fQ0dsBFBQkXx2BlTMj5y/D72eS/Sok4hxg9ZvB6mJuJ4deUQIXUy6Yn2QP/0 3sTI9S2u9Qf6awLvGjij9G9ffsTonM9eg5SG09WJ08i5LgUR+R/poX6rSNOPrE43UtOe4q 474VIKFLI5xBtOac72oaAZUtcfMe2llGXBF9CSiTk8yosHcOWLybeLvGOd+5jA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696042335; a=rsa-sha256; cv=none; b=vFu+7RSeFsPzkQ4NzyaeIzfgR8uouoiJRfIR2luxJadrbs0aWbGrxes+Bl2/1Z6NK940Jb YmEf2o8i69UqJXDylAW8Q7eaJ4oQSEVNx71tk2F8svZauTW3G3CklNZQavrEdAv/kULffG UT6SfHVV49ipyxbfPeecV0NP1VYAU85LL0waaLOoa8MmCl+jHLr8ygJKwcTrjgHFdOah9f 5GsX1lo55+2poKxNFnzanISqLuJidL1pbvFzTfPLg6K5/4GZ1MkdODDehIvu6gGOaySTpU NRBuBhRwAa93p3hkjtvZdSffStiUnDv3oDhWjm0+ybwBpiZG9ZM9sas8aI6/6w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696042335; 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=Po9DONmHAe8MSLs5xnlSKareB4phi7gksX7nqlKf/OA=; b=aB8D3YalQYkF7rz5Owd8JOB61tW+hdVktCArIQ+oVVuU2xlWD1zswOkinnUNMyAJNmx4eP tWZ02vL795oFR6hhc3Sg7GcDlbEgVSCIvI3klRwkvASlxfbrfaHxTCkMTFgvaB3iVKwIEk 2Atw3JdzyxVijwfticZGlgzn8G6RiVO+7JM8qbq99RJN4ISjKGJB36jbiXrpPkDE4dW5T8 2kya3omIacyzWBAS/ZU/v9AmkMz7uEosiY4kyqPm3zoqXcuvawKeRetfiwPKfZze6ccmMi HG/mkHNsSaO3Ubo/a7ZBWqUFvrm7m0NpU5/J6OLkxdBlKJUQA9zezGFYCXfQ6g== 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 4RyBZl2pgMzWJm; Sat, 30 Sep 2023 02:52:15 +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 38U2qFOO044399; Sat, 30 Sep 2023 02:52:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38U2qFZm044396; Sat, 30 Sep 2023 02:52:15 GMT (envelope-from git) Date: Sat, 30 Sep 2023 02:52:15 GMT Message-Id: <202309300252.38U2qFZm044396@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: ac695744e2cf - stable/13 - 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: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ac695744e2cfb461a64018276fb94999fb0cad9c Auto-Submitted: auto-generated The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=ac695744e2cfb461a64018276fb94999fb0cad9c commit ac695744e2cfb461a64018276fb94999fb0cad9c Author: Christos Zoulas AuthorDate: 2023-08-30 20:37:24 +0000 Commit: Kyle Evans CommitDate: 2023-09-30 01:41:23 +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) --- 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 791755ceb14d..42fa1b99e58e 100644 --- a/lib/libc/regex/regcomp.c +++ b/lib/libc/regex/regcomp.c @@ -828,10 +828,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) { @@ -992,7 +992,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++; } @@ -1302,7 +1302,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