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

Miniz fails to locate file in ZIP archive #15

Closed
GoogleCodeExporter opened this issue Nov 18, 2015 · 3 comments
Closed

Miniz fails to locate file in ZIP archive #15

GoogleCodeExporter opened this issue Nov 18, 2015 · 3 comments

Comments

@GoogleCodeExporter
Copy link

Summary: The function mz_zip_extract_archive_file_to_heap() can fail to locate 
an archive member, because it uses binary search in the central directory, even 
if that central directory was never sorted because the   
MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY flag was specified when initializing 
the archive reader.

The problem is caused by the following two lines in mz_zip_reader_locate_file():

 if (((flags & (MZ_ZIP_FLAG_IGNORE_PATH | MZ_ZIP_FLAG_CASE_SENSITIVE) == 0) && (!pComment) && (pZip->m_pState->m_sorted_central_dir_offsets.m_p))
    return mz_zip_reader_locate_file_binary_search(pZip, pName);

The check whether pZip->m_pState->m_sorted_central_dir_offsets.m_p is 
initialized is probably meant to determine whether the central directory was 
sorted.  However, the pZip->m_pState->m_sorted_central_dir_offsets array is 
*always* initialized, irrespective of whether the central directory was sorted 
or not (see the definition of  mz_zip_reader_read_central_dir()).

Hence, a different way of checking whether the central directory has been 
sorted should be implemented.

Original issue reported on code.google.com by jeremy.j...@gmail.com on 9 Sep 2013 at 1:45

@GoogleCodeExporter
Copy link
Author

Thanks for finding this Jeremy.

Original comment by richge...@gmail.com on 9 Sep 2013 at 7:42

@GoogleCodeExporter
Copy link
Author

My pleasure. And thanks for this great library.

Jeremy

Original comment by jeremy.j...@gmail.com on 9 Sep 2013 at 8:38

@GoogleCodeExporter
Copy link
Author

This should be fixed in v1.15.

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

  • Changed state: Fixed

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

No branches or pull requests

1 participant