-
Notifications
You must be signed in to change notification settings - Fork 370
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
Don't do operations on a closed ZipFile
#68
Conversation
When zip file was opened inside the loop and it did not contain the lib inside of it, the `zipFile` stayed non-`null` for all next iterations. This can cause next iterations that fail to open zip file to access previously already closed `zipFile` because `zipFile == null` will never be true. Fixed by moving the `zipFile` declaration inside of the loop.
This doesn't make sense to me. As is, the variable is fresh on each loop iteration - subsequent iterations cannot see values assigned in previous iterations, because it's effectively a new variable. With your proposed fix, it will definitely become possible for values to "bleed through" between iterations, which seems logically incorrect. Finally, I'm not sure what actual problem is being solved here. Is it possible to provide some concrete problem, like a crash report or a reproduction? |
Currently the variable bleeds through iterations and my patch fixes this, not the other way around. But let me try to describe the problem more precisely. This is the crash that we get (relinker 1.3.1):
We don't have a repro but I believe the problem is triggered this way:
My proposed fix moves the |
I don't know how I managed to misread this simple PR, but I did - of course, you're correct. Moving the variable into the loop fixes that problem. I must have mixed up the red and green lines in the diff. This now looks fine to me. Thanks! |
I though something was off with you first comment, it took me a while to see that you probably mixed up the diff :) Thanks for the review! |
@emarc-m would you please review/merge this as well? It's a legit bugfix. |
@benjamin-bader Thanks for alerting me. I'll review as well. |
@blaztinn Thanks for fixing. I'll include this on the next release and update once I do. |
When zip file was opened inside the loop and it did not contain the lib
inside of it, the
zipFile
stayed non-null
for all next iterations. Thiscan cause next iterations that fail to open zip file to access
previously already closed
zipFile
becausezipFile == null
will neverbe true.
Fixed by moving the
zipFile
declaration inside of the loop.