From nobody Mon Sep 25 22:52:16 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 4RvdRh6mDnz4vBlb; Mon, 25 Sep 2023 22:52:16 +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 4RvdRh6Hjdz4Vp7; Mon, 25 Sep 2023 22:52:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1695682336; 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=6v3Qvj674ZPvMpYchnZwUveTxqzri0dHwKiRM5UpQBU=; b=Ya6JdK+L1RLMwNhbNZYAAzClN2IqPu7KmSmQQRS3u1GSr+k93kxnXJXos47IYAD4E3MjN5 Jnnlk/KHL2sGpZ6XcUD8yC9hIoYJdKjWzwhtbixVWoGjo5D0ow1ayC+AAYZz67Y16Vbzmm nmT0BdqTqh8OynLdGM5igw5MGsjltVDcj4JqEWObLhvUhrkCyWMn6YlM2GFx3iCwXzyO+R WDY9UsS4uHNGHCb+yh2AbPIXQCHf9VE+GFSiNRbvZGuh/Cj2SVzwwzqwJ6/EbEnVahakNO PyDOdlCsFDgvg+pHvvM0X+MQlfB99imV8rF7w256/0Ecmlfj84BafWl/yNEJcg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1695682336; a=rsa-sha256; cv=none; b=DXJJhIdbc9RGxmM+aqlAMcuOFfa6oO4JXQJJpYlUiKBrVgWtrGJZffOcqlL71iHm2K1Mya SMr59/uwWpZjsLwB6yqwVJfczGUo3MEDa7gqKk/5HMy7zJV3uElF6rmiIDw5qaYsR9FeTT 9PMp2zWIZ98K3PjjP1x6TKJh2Un5esMx8YfcWXk3FhNvkvdrhE7qvd20h/KmRsW3Rv/E0n TpSV4aGI0/WnmkdTENGSCoNI1zS/h5074UiQc6w7Q6/QKyFg1UBFLe0ThZjgZGMRCfhtFN gJisksjiztQZhHRlvGZ+TkaGBzyX3HFnkBk3Muh8rZ1Ne9BpLoNSjf+ajT/YJQ== 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=1695682336; 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=6v3Qvj674ZPvMpYchnZwUveTxqzri0dHwKiRM5UpQBU=; b=qBGRC/HN6/tOrX6qntXmwwdjd6ZqbfqcB+/G/5p/Q8YAr5lA+ihnj7puNQ/DkPoIpCWjgN J9J7sLvPHHtBG8IAnXfUGvHbBNQujcbBpwnGKe/SepN2oLiGGOZRTjl89h2J3TwMRSyC79 BXx6/bWayD+swfnSVddWttXSXL7lrCsXHLAkwsh0Zj8Vm5Gn6Ft+UN/jmrEmgD0zUZlKwN 9bie1mUeNrxRGnnjf82M+gfFqQKvno4Q0RGQ13/ok/pjTbUxHw6UK39HVsCe+KXjsxcgUJ G4s79S4+Rjgd6XsZ2MS7VjCyE4d2lr3Znyusv3TUt7/3F28iGdmgOawEjU/AqQ== 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 4RvdRh5M81zYGX; Mon, 25 Sep 2023 22:52:16 +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 38PMqGFu041219; Mon, 25 Sep 2023 22:52:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38PMqGn2041216; Mon, 25 Sep 2023 22:52:16 GMT (envelope-from git) Date: Mon, 25 Sep 2023 22:52:16 GMT Message-Id: <202309252252.38PMqGn2041216@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Yuri Pankov Subject: git: 3fb80f1476c7 - main - 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: yuripv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3fb80f1476c7776f04ba7ef6d08397cef6abcfb0 Auto-Submitted: auto-generated The branch main has been updated by yuripv: URL: https://cgit.FreeBSD.org/src/commit/?id=3fb80f1476c7776f04ba7ef6d08397cef6abcfb0 commit 3fb80f1476c7776f04ba7ef6d08397cef6abcfb0 Author: Christos Zoulas AuthorDate: 2023-08-30 20:37:24 +0000 Commit: Yuri Pankov CommitDate: 2023-09-25 22:49:14 +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 Differential Revision: https://reviews.freebsd.org/D41947 --- 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