thaolt / miniz

Automatically exported from code.google.com/p/miniz
0 stars 0 forks source link

Finding entries fails for some files if MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY used #11

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a ZIP file with entries in this order: C, B, A.
2. Open the ZIP file with MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY.
3. Attempt to locate entry C (no flags).

What is the expected output? What do you see instead?
I expect to find entry C at index 0. Instead, it is not found.

What version of the product are you using? On what operating system?
miniz 1.14 on Windows 7 (x64).

Please provide any additional information below.
The mz_zip_reader_locate_file() function does not seem to detect that 
MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY was used, and assumes the central 
directory is sorted. This causes the subsequent binary search for C to fail.

There seems to be a check for whether m_sorted_central_dir_offsets.m_p, but 
m_sorted_central_dir_offsets is apparently always initialized, regardless of 
whether or not the central directory was actually sorted.

Original issue reported on code.google.com by kahmyong...@gtempaccount.com on 8 Feb 2013 at 1:56

GoogleCodeExporter commented 9 years ago
I'm now using miniz on the GL debugger project I'm working on at work, which 
requires zip64. So while I'm adding zip64 I'm also fixing this bug.

Original comment by richge...@gmail.com on 4 Oct 2013 at 10:07

GoogleCodeExporter commented 9 years ago
This should be fixed in v1.15. Would definitely appreciate it if you gave this 
release a spin.

Original comment by richge...@gmail.com on 13 Oct 2013 at 5:26

GoogleCodeExporter commented 9 years ago
Sure! After fixing an unrelated issue in my test, I've confirmed that 1.15 
fixes this issue for me: mz_zip_reader_locate_file() now successfully finds my 
files in an unsorted central directory, while 1.14 fails on the same test.

Original comment by kahmyong...@gtempaccount.com on 15 Oct 2013 at 8:51