From nobody Fri Oct 11 22:11:32 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 4XQLSN70dNz5ZTk8; Fri, 11 Oct 2024 22:11:32 +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 4XQLSN2Q3kz4VKR; Fri, 11 Oct 2024 22:11:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728684692; 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=pflFShCzJTc0+WaQJWse0gmaeF1RXewnH+LFbz2H+Xk=; b=eU7cluP+OoLQSr1SLju3ZlQhxY8E+Z6sgEBBeXv4C7zbjVmJRtR+1gJzatR+oZEB/P+WaO s6cYp/5yz93PzRiEv5QtnVXd9dDHyAj97WuixIgfoImW2AInIoCjeaaPpGRhY5U6WsD4V4 O285Uj1M1yCjbYNCM6XeW0TRmtPWYSDBUx0kya9g2ZCexOatUH9SCSBqyeb0OzzTinNVsY ThO8IUjVtvdglB1s+rH0Laa3lZU7PfX8KnVck31gc6HB1/DB/FR9E5MVWmem+VOnkLOK5Y xoVUdlxcP+l1NFKCLzT0ISvQ0yqiWBNKobHJ88RWSoWNa4w93tiCXaU5kuki4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728684692; 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=pflFShCzJTc0+WaQJWse0gmaeF1RXewnH+LFbz2H+Xk=; b=qHaWeC2a4kFEw3Ckz/7/wOd2aJouTsMKYXTKwdbQb4RQsQ/cluf3dEb9myyUwrTHmsQRXT 0eI7y/Lr0AsKKXtjqPZPMbEQdws0wcsNwUY+ripXIPlEdIWUw9O9EwQz0IZickHn2tl92L RCkjSIvgiuGDcAR0/cWErblfxRtZN5I9ct0nkoc8rhs7PmCytWtpP2Ze0wdvo8+ihFF9l6 gnTYDCndVrzH3XMKYFapxvUo5Ir61QcZq1bcSj1MwfQZiWHeTRELAldomqdvtLte7AgsqK UjYPu6g/1oUe4LnT7bbynIJOZr48dk7EBqP7qiWrmoIUdIpRWunmIQjTb/mxvg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1728684692; a=rsa-sha256; cv=none; b=vd3RqrM+pzp+SyRII1Riv1Hu1kiUWky7CrP4WQ0GLdhNqi3z6k8SVbUoS3QKasb219Tx6s xuBFf5VBBgXRgizs76b75X9AAGljScGdzS3GwCToN3Y1gVCAP84e6/TznrhlswxrHZgbFR L4uvfKfa5mwFF5xn5tZMoN7pOGge0oudzbpqe+xjhWDWGDG54NcPS3iZObmxq6zFYTvYDz r5jz5Wavr9vpRdSYarqvgKWsu+EPnJTzeUZHLPFZjNYeR4aE9RZUUFEYdXKGfz9NZYKvWi 75qoxjVKhQkc27VoXAeDQ703DknE/dKv0U08hqVoM8dsFGgwZRUvbBATODz4JQ== 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 4XQLSN21fMzyrK; Fri, 11 Oct 2024 22:11:32 +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 49BMBW20029197; Fri, 11 Oct 2024 22:11:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49BMBW67029194; Fri, 11 Oct 2024 22:11:32 GMT (envelope-from git) Date: Fri, 11 Oct 2024 22:11:32 GMT Message-Id: <202410112211.49BMBW67029194@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: 03b4f232354c - stable/14 - 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/14 X-Git-Reftype: branch X-Git-Commit: 03b4f232354ce68fe1cb462038654f6527f63579 Auto-Submitted: auto-generated The branch stable/14 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=03b4f232354ce68fe1cb462038654f6527f63579 commit 03b4f232354ce68fe1cb462038654f6527f63579 Author: David Jones AuthorDate: 2024-10-11 15:49:17 +0000 Commit: Warner Losh CommitDate: 2024-10-11 22:11:02 +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);