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

lzham_lib_z_deflateInit2 writes zlib header/footer even if negative window_bits passed #13

Open
AndrewSav opened this issue Sep 15, 2015 · 0 comments

Comments

@AndrewSav
Copy link

In lzham_lib_z_deflateInit2 function of lzham_lzcomp.cpp there is following code:

 if (method == LZHAM_Z_DEFLATED)
      {
         // Force Deflate to LZHAM with default window_bits.
         method = LZHAM_Z_LZHAM;
         window_bits = LZHAM_Z_DEFAULT_WINDOW_BITS;
      }

A little bit down below we see this:

 if (window_bits > 0)
         comp_params.m_compress_flags |= LZHAM_COMP_FLAG_WRITE_ZLIB_STREAM;

This means that if you pass deflate as methods and -15 as window_bits as you would with zlib and expect it not to write zlib header/adler-32 footer you will be disappointed. The first piece of code will change -15 to 15, and then the second piece of code happily will add the header/footer flag.

Is this intentional?

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

1 participant