zlib icon indicating copy to clipboard operation
zlib copied to clipboard

Inflate: max distance taken from header even if bigger window size provided

Open puzrin opened this issue 6 years ago • 1 comments

Ref: https://github.com/nodeca/pako/issues/174#issuecomment-535347692

Found this, when been reported about problem with decompressing data with wrong window size in header. I tried to force windowBits to max, but this did not helped.

  1. Here you ignore window size from header, if been passed in options before.
  2. But here you still use len instead of state->wbits to define state->dmax. Than make passing bigger windowBits "useless" for inflate, when header exists.

I don't know is this intended behaviour or not. Look like a bug.

Could you comment or fix?

puzrin avatar Sep 26 '19 06:09 puzrin

i think deflate cannot generate such data whose distance is greater than the window size( written in zlib header )

minchai23 avatar Sep 08 '21 11:09 minchai23