From nobody Sat Sep 30 02:52:11 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 4RyBZg56SMz4v8ks; Sat, 30 Sep 2023 02:52:11 +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 4RyBZg4RRhz4XFP; Sat, 30 Sep 2023 02:52:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696042331; 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=z06gshf9JWJSiaP18FWJYCimqEt3scNhsKa2UwGOqO4=; b=qVdhmC8m2Pro0V6FpeRLE/TKTObEuvoDGV0nTBjssirbVqRAXZcsoZHd13dWujY1fqi2li nDeL5JJj2cMu/WG9HT7gUehRtrU6JNVoPBJJXdRheREjWlnkRV+m8iVf37oUYDmBRc92dq SbQ2YguOqIjKIEmPQ3qOMPO3ug/mLj3Az/Q9/0EB8nGt0Yty7bz72ybQgqkChSKF+MO59x g4arQwY/RgFuCjzE3PQYMCPXASqCMztGkyCmQqxFGf0MdaZx42x2XL5zRwYHeqZT+BYTFR tSRU14jfb7/hvPUSHLs/H6fBbvepqCPxRxBhMAnZjlj7ovFRPthaCWC81KNEog== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696042331; a=rsa-sha256; cv=none; b=gFqsOuBi6R8ZfCN8XKO4chYbd9hJwcWCP+cmsZr+RJfaUmV8nfJVsJU3qv4AAfhSMfUuBT opOnQZIlfbfLyM3WhVcdwX8cyvuOuF4N0lRyCupW90dbf1h5upLGDIbmoZQ4gl8ouhPr17 Ib7KB1Tc6ctA5wzWoIuqL7vHLb/FcAvp4kFpxlwQujO8d6nptH1XG9Lyh58/YOgfdcqYud xrYpFXnjykSSThIHPTdTxzNjL3jnXAheULC8dIWTSxpHxUR3Ga2k8GSYaD2h+XblQIGrIx FzpFHZze94gmoKGD4NujpVvhpsXSb5GFE48dR8mMez2BHslR0yqVzMqGq6iZ4A== 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=1696042331; 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=z06gshf9JWJSiaP18FWJYCimqEt3scNhsKa2UwGOqO4=; b=g4rGn6gza6n2lTAYv/y7PVu9CJVt3Q7dDaCVRtVZoIztdFRxaNn4raCQSMXDHPu/8ijj+A RTQGGudUEX9pmPRst+zajkfOzFTe4TZ7f+G90ASobwZIT4JkC4PznSo4mJFsXjSytFxYk4 19vXJDktr+Oy8pgC0b7KNCUvadqyZOuQWh98aPnObRhmVhvF8cBKnW3S0KVDqbo9Vdje3u mBReSuPrvY3A2bYcyPOI54IDw+eXmFcVroJryaWpn/2vaJN4ZXaYZRjFX6BHuHR79K+4q0 inxHm7m+5JqEP3uuuKdraFYI07nihNaQBZwa529ISI7mPibsp35ZQhD/QH4FfQ== 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 4RyBZg3W29zWPP; Sat, 30 Sep 2023 02:52:11 +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 38U2qBvU044234; Sat, 30 Sep 2023 02:52:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38U2qBEV044231; Sat, 30 Sep 2023 02:52:11 GMT (envelope-from git) Date: Sat, 30 Sep 2023 02:52:11 GMT Message-Id: <202309300252.38U2qBEV044231@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: 25307d6c9279 - stable/12 - 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/12 X-Git-Reftype: branch X-Git-Commit: 25307d6c927934dd44628e06cbc7047415fb6931 Auto-Submitted: auto-generated The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=25307d6c927934dd44628e06cbc7047415fb6931 commit 25307d6c927934dd44628e06cbc7047415fb6931 Author: Christos Zoulas AuthorDate: 2023-08-30 20:37:24 +0000 Commit: Kyle Evans CommitDate: 2023-09-30 01:41:57 +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 fc66ea32046a..e93ea02f5873 100644 --- a/lib/libc/regex/regcomp.c +++ b/lib/libc/regex/regcomp.c @@ -814,10 +814,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) { @@ -978,7 +978,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++; } @@ -1288,7 +1288,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