From nobody Wed Nov 08 01:03:20 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 4SQ6K527PCz4yyMC; Wed, 8 Nov 2023 01:03:21 +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 4SQ6K518txz3Vss; Wed, 8 Nov 2023 01:03:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699405401; 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=lzXVCzfACLxgDpKGaJnDJl5Dt5fIOkyn9MxyfwcnK8E=; b=Yu20rsRDlQv2/2e0tj03WBw+fZem6KcS4QynwYnQAVUQBPCR6styQYBeeGEgDt6+9YET3j a2azy+Pb5WOC5O13YftI1cdAmZ54ZyY6YnecVe/Ci5sGJ1DYA1CqMyO5jiWN8pzjfUFgmt jCxZ2dolE4wnuJ5ZZg+TTLqZxW2a1S0O8+/rl/xmJ0N2BcWfNVQqb4fPorB9k1GC3ffncZ Ias5P/RgVCVCBlmQ9zaV3abc1iT1Qjtw5F5FVxLnkNpY/VWJ1gxT07dfel3mmJAReDoPoi 5vZSYacLhngq5ZG5uiJYf1EhcmS2FaylbEEdAfVETKSgciKyq4xlmMg/32CviQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699405401; 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=lzXVCzfACLxgDpKGaJnDJl5Dt5fIOkyn9MxyfwcnK8E=; b=ljsS+5524XACH+AjBPTfg5weMbh7uu1Vod5L+2BsgffQGrHnQxUetXTjc/guA613TQJl9h /TdBnyrl2N+WuBZeiYrPW/RSkatTMOKIsMyNCgxis+OjlL/U26mTSbYE9qh/YnOTpbgsy1 k95REMgztrOGKgC3BLJCd12Liko9bFTcelzipS49rPmxoEiHREtH6ng181FeBwCGw4rXz6 BMJNUl/gtb9leFv3X4Ylhh5NCs8lPr9zciwxVyo4pVljLNTCH+VPVCIu5YY2geb99Gd+wV xeVBc+lL+2CXiT8GV4els4kWHH48zd4JHDo58Ei6Cw1A/yBUO15SYvqFZeyHVg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1699405401; a=rsa-sha256; cv=none; b=wLWvzKZgnZ+BeiFjuRlxlHMO7Wvnr/SMScff9K2m8r2M9nQmO7xpt7rocxF8+/95/pNVLt 6PoV9b+p2QByOpcKq41UCLtvardG3bA1Kc/FxiFolZbjPLl7Mb/qEjzGlJjrPGChMwqMXR ij8OBpWNdoqwuZ7TqZsmIGsSU1nAKglPzSORknq4w8RkCflkU5SN+hsDjJxfBTYmN2TrIx wtwBDp4WL1XAscYRkSzn11zUmigZ4+6n1Stzw3gnmDXrrIoGYfJsQ0szKVPNVbnpR7U6YO NFCSGHtb4LB/GnE7ru+IjjLJtmhbpgYgZn/TkE/MioHxXwBbpFVIGTzmRJY4Hg== 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 4SQ6K50CM4z1CBn; Wed, 8 Nov 2023 01:03:21 +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 3A813KG1005004; Wed, 8 Nov 2023 01:03:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3A813Kfq005001; Wed, 8 Nov 2023 01:03:20 GMT (envelope-from git) Date: Wed, 8 Nov 2023 01:03:20 GMT Message-Id: <202311080103.3A813Kfq005001@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: 5e0387e2ec6e - releng/12.4 - 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/12.4 X-Git-Reftype: branch X-Git-Commit: 5e0387e2ec6ed9b14b3c6088c19079db15a52eae Auto-Submitted: auto-generated The branch releng/12.4 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=5e0387e2ec6ed9b14b3c6088c19079db15a52eae commit 5e0387e2ec6ed9b14b3c6088c19079db15a52eae Author: Christos Zoulas AuthorDate: 2023-08-30 20:37:24 +0000 Commit: Ed Maste CommitDate: 2023-11-08 01:02:08 +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 56b09feb23d98fcd0c4aed8d4f907a5a2f6b5ea9) 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 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