Comments (6)
This bug breaks some stuff on x86_64, such as extracting certain compressed
files.
If you're having issues with x86_64, try these changes before giving up on this
lib.
Original comment by [email protected]
on 30 Mar 2012 at 6:50
from miniz.
Confirmed.
Original comment by [email protected]
on 22 Apr 2012 at 12:21
from miniz.
same issue here but not with all files...and i noticed that under unix this
happens more often. However the compressed files are not really damaged...only
the crc32...to save the files already compressed force to ignore crc.
the patch suggested seems to fix.
Original comment by [email protected]
on 24 Apr 2012 at 6:27
from miniz.
Thanks for the reports - I'll try to repro this and figure out what's going on.
I would typically have used mz_uint32 here. I think I only used "mz_ulong" in
this context to be more compatible with zlib types, which I think is somehow
biting me here.
If mz_ulong is actually 64-bit I could see this function breaking. Let me see
what I can find.
Original comment by [email protected]
on 20 May 2012 at 12:12
- Changed state: Started
from miniz.
Okay - it's definitely caused when mz_ulong is 64-bits. The CRC32 doesn't get
computed properly because the high 32-bits have are set, and they get pulled
into the CRC computation loop. I've checked all the other code that uses this
type to ensure it doesn't have similar issues.
Here's one way to fix it. I'm going to release an update today that addresses
this, as well as a few MinGW compilation warnings/issues.
// Karl Malbrain's compact CRC-32. See "A compact CCITT crc16 and crc32 C
implementation that balances processor cache usage against speed":
http://www.geocities.com/malbrain/
mz_ulong mz_crc32(mz_ulong crc, const mz_uint8 *ptr, size_t buf_len)
{
static const mz_uint32 s_crc32[16] = { 0, 0x1db71064, 0x3b6e20c8, 0x26d930ac, 0x76dc4190, 0x6b6b51f4, 0x4db26158, 0x5005713c,
0xedb88320, 0xf00f9344, 0xd6d6a3e8, 0xcb61b38c, 0x9b64c2b0, 0x86d3d2d4, 0xa00ae278, 0xbdbdf21c };
mz_uint32 crcu32 = (mz_uint32)crc;
if (!ptr) return MZ_CRC32_INIT;
crcu32 = ~crcu32; while (buf_len--) { mz_uint8 b = *ptr++; crcu32 = (crcu32 >> 4) ^ s_crc32[(crcu32 & 0xF) ^ (b & 0xF)]; crcu32 = (crcu32 >> 4) ^ s_crc32[(crcu32 & 0xF) ^ (b >> 4)]; }
return ~crcu32;
}
Original comment by [email protected]
on 20 May 2012 at 12:20
- Changed state: Verified
from miniz.
This is fixed as of v1.13. I've credited you guys at the top of miniz.c. Thanks
a lot for reporting this!
Original comment by [email protected]
on 20 May 2012 at 4:41
- Changed state: Fixed
from miniz.
Related Issues (20)
- Decompress consumes an extra byte when extra data are provided HOT 18
- Support for password HOT 4
- PATCH: Add allocation and free functions to allocate compressor/decompressor structures HOT 2
- PATCH: Undefined symbols for 64-bit variants of stdio functions on Mac OS X
- Compiler warnings on strict aliasing HOT 1
- enumeral and non-enumeral type in conditional expression
- Windows "Extract All..." functionality doesn't like tiny files in zip files created by miniz
- Suggestion: Filter parameter for tdefl_write_image_to_png_file_in_memory()
- [PATCH] supports armcc
- Support for reading archive comments
- mz_zip_writer_add_file does not support directory
- Remove archived file from central directory
- Wrong number of files returned for more that 65535 entries HOT 1
- Can not be used as drop-in replacement for zlib with libpng
- Multiple linker errors in VisualStudio HOT 1
- Extract all files from zip without knowing their names.
- Compress a folder
- Package Pre-Built Binaries Separately
- API to delete a file from zip
- Has anyone got it working on android devices (arm based platforms) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from miniz.