trifectatechfoundation / zlib-rs

A safer zlib
zlib License
139 stars 15 forks source link

missing update to `state->back` #207

Open folkertdev opened 1 month ago

folkertdev commented 1 month ago

we miss the state->back = -1 in our code. no idea when that is useful, but probably a bug.

            /* use inflate_fast() if we have enough input and output */
            if (have >= INFLATE_FAST_MIN_HAVE && left >= INFLATE_FAST_MIN_LEFT) {
                RESTORE();
                functable.inflate_fast(strm, out);
                LOAD();
                if (state->mode == TYPE)
                    state->back = -1;
                break;
            }
            state->back = 0;
bjorn3 commented 1 month ago

This way added way back in zlib 1.2.3.4 in 2009: https://github.com/zlib-ng/zlib-ng/commit/f6194ef39af5864f792412460c354cc339dde7d1#diff-a4d1ad62d5ea3dd46bc58016d6a642b364511e75ac9647c4dd33ff9a906777c7R1010 I couldn't find any commits for individual changes from the previous release though.