From nobody Fri Oct 11 15:55:34 2024 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 4XQB6Z32qWz5Z4GK; Fri, 11 Oct 2024 15:55:34 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XQB6Z21mgz4wMd; Fri, 11 Oct 2024 15:55:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728662134; 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=+HNMk5wzQIa4yMzys+ZiHlYh7CrqVSYrTuR5ihrJY2c=; b=ugvVpJJSmM9GYx3ynI69AmRN5GEutv8NjNc8kZQwT1i2ciMtz4S0D5L/2/KJlqEdPHUs76 MIIn5l3EXyTcmCBTp+btHK2GxMh2n3Uj2IIvoEqphGPQz0RpFE/dg3LGoZCQyq4FkLJX9i pGjeRwecsmMP1o87f3KycCEBBCSL9+AUP6NfElcJuRLajUVB2Paqc/76L+AwCYkyxkf+0w 0RrihoY7m45Bb7DqaRAaLwROpbGFbMfjDd3B2KJ04ayZyoo3VHf4LbxmoQcBbTRnz+/kF4 enfYuJuzRR6x3Q6wSnJOS0948podW8Pa+Ye6DAZNK+MJo+nwHbP5sOoabBKexg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728662134; 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=+HNMk5wzQIa4yMzys+ZiHlYh7CrqVSYrTuR5ihrJY2c=; b=nOtumi+iJu3TxB1hHnmpG21rGZafBhvfzhPpPwXTZHLrxz2Ip4uGDnZxhDVse8gAgy7mUp HktLas6XoHyRH63EpxzK8jjZWJ8GGg+e/GIZrrgzc2NWMHi7Zj27o2W0VFkfDxgmrXPv1x NHd9SnVY7yBcgmr9lukoY1TqBoAVPlr0UHnmTbbpw2KegSSN9X532D8n1rD+ZcoQfqj1bA 8TlCzFRMOr2sURLj7Taz/JqG9i2kbMXnHe2PRvafb4mXxObzglKVs2E4pVo8LblumnIszp gHwxn8JMKVo1/KGlgv2SfKgGEbiVofpcVK1M0B1fYpu+t9RGdLIgmqXF4l2UMg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1728662134; a=rsa-sha256; cv=none; b=m4U6APe+27bnoAUc2QgmclA8J9i/cGzwRSvGxSQSV9vJ/bKnMaVD/qL4xszKJUhHotle7Z ZH6SCkqJoHkzhJwhBfZD8dx6wYF1SyctplC8yqM6J7iUjnkDvfV3eCXa5b1OGCYI48uzV0 jjpE20OvKns3VbqA/9efFUeUKV17XCW6+mSpYNUG0GskRoIJSjHX/yY4deVIRgmEUVlU+K L7hZ7K6zLxviA2HXFO2Ie2tKoFHAA1V2Hy1L7CQdd4OF9Kr3xvHat9WZV77LG48jPE/4Lx fUq6+Jf/RQDqpgg8nNDl2GtU/7e3roHClkRhl9XX93r2xuV7WY0MoaLmCMdNHQ== 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 4XQB6Z1f0Hznrc; Fri, 11 Oct 2024 15:55:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49BFtYZa088335; Fri, 11 Oct 2024 15:55:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49BFtY88088332; Fri, 11 Oct 2024 15:55:34 GMT (envelope-from git) Date: Fri, 11 Oct 2024 15:55:34 GMT Message-Id: <202410111555.49BFtY88088332@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 818c7b769a4f - main - uncompress: Avoid reading an extra byte 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 818c7b769a4f7d3c8fecc4cf491f4e22ef816eba Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=818c7b769a4f7d3c8fecc4cf491f4e22ef816eba commit 818c7b769a4f7d3c8fecc4cf491f4e22ef816eba Author: David Jones AuthorDate: 2024-10-11 15:49:17 +0000 Commit: Warner Losh CommitDate: 2024-10-11 15:50:09 +0000 uncompress: Avoid reading an extra byte When reading the next code in a stream, avoid reading an extra byte if we're going to throw it away. When there's no more bits to extract from the stream, bits will be 0 and we'll mask the read byte with 0 anyway. At worst, this will avoid reading one past the end of gbuf array (which is not possible in well formed streams). PR: 127912 Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D47041 --- usr.bin/compress/zopen.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr.bin/compress/zopen.c b/usr.bin/compress/zopen.c index be66358884ca..cb7e6e9eb10a 100644 --- a/usr.bin/compress/zopen.c +++ b/usr.bin/compress/zopen.c @@ -620,7 +620,8 @@ getcode(struct s_zstate *zs) } /* High order bits. */ - gcode |= (*bp & rmask[bits]) << r_off; + if (bits > 0) + gcode |= (*bp & rmask[bits]) << r_off; roffset += n_bits; return (gcode);