From nobody Fri Oct 11 22:13:02 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 4XQLV70nlmz5ZV1p; Fri, 11 Oct 2024 22:13:03 +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 4XQLV674zWz4Xcf; Fri, 11 Oct 2024 22:13:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728684783; 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=FUgKCo1aifGjEFiJ+IF2LTe/RhrDy7AcNvbKHmnMCHA=; b=G4NSnedzggjYbgXm0Aiv3/IXyiRYnktC9uKyEjixB9tmiCUsy4HyHd5baoJol7n9JImZyR K+swYKN8kzx7NaAPxXrEAsiE0xcgSwfaKwQlyZRBybL4mV29jv3H1DbDj+saXFDBJfQrdl 1uFIlhyguBV070XcKKtivNbXxiRA/VnAyXwQBP68+/Bg8pUixrLELE8NIUeNfjCc5sRazs ZkTCleOl5dmEppi/hZjkCePGNC7dYoSI73CCCllTOJxv9QT3cypCY6SrTdtQ5uwZgC9Ej5 l73O+9gfQkfqRGqez4Wsjx/Q+PIRSWyeFkPrgogONyDhe6TsLUy1F1/DDj1g8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728684783; 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=FUgKCo1aifGjEFiJ+IF2LTe/RhrDy7AcNvbKHmnMCHA=; b=VBw0fdQKs/tSjlYUngfXkS304ETzv4NhFdffGUDfufGS0ck3B1REqHfROF/IpTpxIuW4eh nfbAFpfLu4TqGFYonXrsMNd3ihGFlKpTv1PhrRg4bm5z/K0AYd4dBd9RbIwVPWaMzXlfL5 zLCpwHyKt6qZGjBTQzgyAGzjZHKCsfU72YJpw2TlKS/1qR6b1bLy7OEYCIrGkOqwwYubxQ DA1MKa4qRWELr8Vy9w4gcpC+QfooVbvd67r/WZtI8mkOGqmYb/ZWIcIaiqDgbgS32Gd+LS DUYV4jqw+fFWt0RHO+RsdtFiSivRW1xbtocmceH/jvuZeh+5es23KlgdVDMcaQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1728684783; a=rsa-sha256; cv=none; b=GP/bz1RXj475FX/4N4HtILIqc6wxrYizifw49nZJQ5SBXQ1sFcAuLZl1eC/if24scbnL4e cui3NH1OpbrY1jSWbJxUzxdMXt3eiBIQhBXzifb0xyouXO9BFMlf2/9mLAUaV+MKeIjhXW y3Pdn3MVszQOZ5Whbqqc3LtKFOwx1DoQFbi4hAeJVRevAvO0YfVNgx2gjSWsT4lcE8sdkt Ho5+DvpI8HDF/GffkX/4KIV+vwlMzDX5DXytM3F9JL1owi1JmMQ/MDVI4bYlHc5370UQSU AYcQp+oGhyx1knko7bJgIirgBxPsRLenuhfE5TKQWDiwDh49JmMRWrXboJpsjA== 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 4XQLV66hqnz10NP; Fri, 11 Oct 2024 22:13:02 +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 49BMD2tg035440; Fri, 11 Oct 2024 22:13:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49BMD22A035437; Fri, 11 Oct 2024 22:13:02 GMT (envelope-from git) Date: Fri, 11 Oct 2024 22:13:02 GMT Message-Id: <202410112213.49BMD22A035437@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 7e229794ca37 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 7e229794ca37d25265b0472bce26e8fd2b9bee2c Auto-Submitted: auto-generated The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=7e229794ca37d25265b0472bce26e8fd2b9bee2c commit 7e229794ca37d25265b0472bce26e8fd2b9bee2c Author: David Jones AuthorDate: 2024-10-11 15:49:17 +0000 Commit: Warner Losh CommitDate: 2024-10-11 22:12:41 +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 (cherry picked from commit 818c7b769a4f7d3c8fecc4cf491f4e22ef816eba) --- 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 a5b34ef83ecb..0d0900cabfa1 100644 --- a/usr.bin/compress/zopen.c +++ b/usr.bin/compress/zopen.c @@ -623,7 +623,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);