-
Notifications
You must be signed in to change notification settings - Fork 285
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
Fix zip_delete_entries bug #320
Conversation
This is not expected use case. You cannot delete and append new elements on the same opened archive. You have to close archive first (to refine central directory), and then you can reopen and append stuff. |
@@ -666,7 +666,6 @@ static int zip_central_dir_move(mz_zip_internal_state *pState, int begin, | |||
|
|||
if (next && l_size == 0) { | |||
memmove(pState->m_central_dir.m_p, next, r_size); | |||
pState->m_central_dir.m_p = MZ_REALLOC(pState->m_central_dir.m_p, r_size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you explain why?
we should free memory if not needed
@@ -735,8 +734,7 @@ static int zip_central_dir_delete(mz_zip_internal_state *pState, | |||
d_num += end - begin; | |||
} | |||
|
|||
pState->m_central_dir_offsets.m_size = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you explain this change?
I would understand if we replace mz_uint32
by m_element_size
@jinfeihan57 - can you also take a look into this PR, becaue you mainly implemented |
486d40e
to
fbaf7b8
Compare
I'm closing right now. If you find time to elaborate more about the fix, do not hesitate to re-open the issue. |
Purpose
Fix bugs in zip_delete_entires which crashed the central directory states.
Elaborate
I discover these bug when trying to use this API along with other entry writing APIs in same zip_open/zip_close section, for example: