Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about windowBits=8 #737

Open
cfg1234 opened this issue Nov 3, 2022 · 3 comments
Open

Question about windowBits=8 #737

cfg1234 opened this issue Nov 3, 2022 · 3 comments

Comments

@cfg1234
Copy link

cfg1234 commented Nov 3, 2022

I set windowBits = 8 when calling deflateInit2_ ,which actually set to 9:

zlib/deflate.c

Line 297 in 04f42ce

if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */

The comment says there is bug when window size is 256 byte.
I notice that this comment was created over 10 years ago.
Why can't we fix it yet?

@madler
Copy link
Owner

madler commented Nov 3, 2022

"we"? Are you suggesting that you're going to fix it?

@cfg1234
Copy link
Author

cfg1234 commented Nov 4, 2022

I'd like to, but I wonder why this bug has not been fixed for so long(Maybe it's a difficult job).So I need more information about this bug.

@cfg1234
Copy link
Author

cfg1234 commented Nov 4, 2022

I found that MAX_DIST returns negative value when w_size < MIN_LOOKAHEAD:

zlib/deflate.h

Line 284 in 04f42ce

#define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD)

When windowBits = 8, w_size = 256, then MAX_DIST return -6. It's an illegal distance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants