From 6daf378492ce8ec95129bd22135eeaae7d31f01f Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Tue, 7 Jan 2025 15:53:26 +0000 Subject: [PATCH] fix(inflate): byte boundary aligning underflow --- lib/inflate.luau | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/inflate.luau b/lib/inflate.luau index 1c49ee0..36d6235 100644 --- a/lib/inflate.luau +++ b/lib/inflate.luau @@ -313,10 +313,10 @@ end --- Processes an uncompressed block local function inflateUncompressedBlock(d: Data) -- Align to byte boundary - while d.bitcount > 8 do - d.sourceIndex -= 1 - d.bitcount -= 8 - end + local bytesToMove = d.bitcount // 8 + d.sourceIndex -= bytesToMove + d.bitcount = 0 + d.tag = 0 -- Read block length and its complement local length = buffer.readu8(d.source, d.sourceIndex + 1)