From nobody Thu Nov 03 06:41:59 2022 X-Original-To: dev-commits-ports-main@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 4N2vLb2nFsz4h7lG; Thu, 3 Nov 2022 06:41:59 +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 4N2vLb258Gz3wjq; Thu, 3 Nov 2022 06:41:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1667457719; 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=8HGKvJQznQFjaEOR4y0ul8vegLpoMsQ05cwpGzI4ZZA=; b=SnKdt65e0pI2bPhC5tHe+kTsVgO1cBssX7EbGN8QfqJGdP4rflPwgbIWp0MYbQYJRgd2AC pAQtaC50JdbHKi0gj7Iqw/YirDmkLelmumtI+3fxHppI418gNBBalhWlWa8Mnho1GlnMYX glp0fsmmmBzWxQQr7XM5zQ++qSXytso9PDpq6srTqiJXT5Dk1CtIlmEAq0Jx0GPiP55S1A TcNFjeljlUdQggPHvZCbjqMcWkeaPjbBugLDJ/duZGumfWhfM3TOxdqDpXU48n4+4nv/Hj BHunF+pryQLp3QUgiylZRL8IXw5Qbe40G3sX8LJ0xqcnYXNuo6r4vWqU9er+zw== 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 4N2vLb18HlzRQM; Thu, 3 Nov 2022 06:41:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2A36fxZ7020348; Thu, 3 Nov 2022 06:41:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2A36fx7x020346; Thu, 3 Nov 2022 06:41:59 GMT (envelope-from git) Date: Thu, 3 Nov 2022 06:41:59 GMT Message-Id: <202211030641.2A36fx7x020346@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Craig Leres Subject: git: 5ac4f1e50257 - main - editors/nvi2: Fix core dump when tags file pattern has a trailing '\' List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: leres X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5ac4f1e502572cd1e2e8678600a56b3894af2e95 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1667457719; 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=8HGKvJQznQFjaEOR4y0ul8vegLpoMsQ05cwpGzI4ZZA=; b=A/bFHrGw/y/OpMb5kSmqBcoufqolMfqTS1IhSqLGHYySYuAzD8MHMHMdCcTo39TCfY7xmv VJ5UYmfgn/p7aOTS/BaUMnDmrje4bE+BupA9QcOE7O1mQy1YlUeaZ3+NY+rK+EitPWFBrc l7Mx5CDPek5WJ+dPJh73LaTeo3CLsx2V8XU/6nVslc8KU+Yy33wnULTvw4qITa2RrTnipL QqZii+XSuiga8XC/1ID3nrU7x2hW128e/rnu921KLPSrI3CX4PDTWRDcJV71onH3vWYhU5 rnTbo6oGGZv0HQYCkETvoMlXgsR+SI7yvhzOC8RpQo/mgOBIxSbWoawff2YdBw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1667457719; a=rsa-sha256; cv=none; b=h0UBfsNpHLpfWhgINVpi70kuLIlD29mZlEx27bKxvf8qTdZ5IFUIYoY0jGjkomzScSL4mZ 4fL+7+UXF9MQN56v+UBEzNxZDn9toUcCGWzfl7fct9Bj8akcE+wcPSO43AT3twqjDCKGzV 7JP8vDDO3GwxawxUGchkKx4E8BFOE9yhJ8AnpmLmigUbkPHhY2akTUYbBbUEOQDeTtdge+ N+MlEUr0nhGjbK4EPd7Cd2k+RsUcilVzx5ixMuBHc3GqmoEVaYZVfLFVDfIOItp4kRBw+F aMyURSyCaqWKWjZbXg7h40NxXD6L6Il6aBpaCkN3Fm5sUx18BYaekW8l1Dl5VA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by leres: URL: https://cgit.FreeBSD.org/ports/commit/?id=5ac4f1e502572cd1e2e8678600a56b3894af2e95 commit 5ac4f1e502572cd1e2e8678600a56b3894af2e95 Author: Craig Leres AuthorDate: 2022-11-03 06:41:34 +0000 Commit: Craig Leres CommitDate: 2022-11-03 06:41:34 +0000 editors/nvi2: Fix core dump when tags file pattern has a trailing '\' If you create a tags file of a macro that ends with a '\' and tag for it, vi dumps core. For example: zinc 76 % cat test.h #define LATIN2PLAIN(ch) (((u_char)ch) >= 0x80 ? \ pgm_read_byte_far(pgm_get_far_address(latin2plain) + \ (((u_char)ch) - 0x80)) : (isprint(ch) ? (ch) : '_')) zinc 77 % ctags test.h zinc 78 % vi -t LATIN2PLAIN Segmentation fault The problem is that the loop variable is unsigned (size_t) and it gets decremented twice: 1 -> 0 -> 4294967295 Apply the upstream patch to solve this: https://github.com/lichray/nvi2/pull/111 --- editors/nvi2/Makefile | 1 + editors/nvi2/files/patch-ex_ex__subst.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/editors/nvi2/Makefile b/editors/nvi2/Makefile index d9f955eb7d57..dfa27945a477 100644 --- a/editors/nvi2/Makefile +++ b/editors/nvi2/Makefile @@ -1,6 +1,7 @@ PORTNAME= nvi2 PORTVERSION= 2.2.0 DISTVERSIONPREFIX= v +PORTREVISION= 1 CATEGORIES= editors MAINTAINER= leres@FreeBSD.org diff --git a/editors/nvi2/files/patch-ex_ex__subst.c b/editors/nvi2/files/patch-ex_ex__subst.c new file mode 100644 index 000000000000..6ff00423160c --- /dev/null +++ b/editors/nvi2/files/patch-ex_ex__subst.c @@ -0,0 +1,12 @@ +--- ex/ex_subst.c.orig 2020-08-01 22:27:51 UTC ++++ ex/ex_subst.c +@@ -1194,7 +1194,8 @@ re_tag_conv(SCR *sp, CHAR_T **ptrnp, size_t *plenp, in + for (; len > 0; --len) { + if (p[0] == '\\' && (p[1] == '/' || p[1] == '?')) { + ++p; +- --len; ++ if (len > 1) ++ --len; + } else if (STRCHR(L("^.[]$*"), p[0])) + *t++ = '\\'; + *t++ = *p++;