From: Dougall Johnson Date: Sun, 28 Dec 2025 23:41:02 +0000 (-0800) Subject: Consume bits before branches in inflate_fast. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=56b8a0d400e8f83ab249df412c5b47724efadc19;p=thirdparty%2Fzlib-ng.git Consume bits before branches in inflate_fast. --- diff --git a/inffast_tpl.h b/inffast_tpl.h index 4798d81eb..4b1447cb7 100644 --- a/inffast_tpl.h +++ b/inffast_tpl.h @@ -151,20 +151,20 @@ void Z_INTERNAL INFLATE_FAST(PREFIX3(stream) *strm, uint32_t start) { REFILL(); here = lcode[hold & lmask]; Z_TOUCH(here); + DROPBITS(here.bits); if (here.op == 0) { *out++ = (unsigned char)(here.val); - DROPBITS(here.bits); here = lcode[hold & lmask]; Z_TOUCH(here); + DROPBITS(here.bits); if (here.op == 0) { *out++ = (unsigned char)(here.val); - DROPBITS(here.bits); here = lcode[hold & lmask]; Z_TOUCH(here); + DROPBITS(here.bits); } } dolen: - DROPBITS(here.bits); op = here.op; if (op == 0) { /* literal */ Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? @@ -291,6 +291,7 @@ void Z_INTERNAL INFLATE_FAST(PREFIX3(stream) *strm, uint32_t start) { } else if ((op & 64) == 0) { /* 2nd level length code */ here = lcode[here.val + BITS(op)]; Z_TOUCH(here); + DROPBITS(here.bits); goto dolen; } else if (op & 32) { /* end-of-block */ Tracevv((stderr, "inflate: end of block\n"));