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

fix race-condition crash when extracting data and extracted files are (re)moved #260

Merged
merged 2 commits into from
Oct 18, 2018

Conversation

devsnd
Copy link
Contributor

@devsnd devsnd commented Oct 17, 2018

To reproduce you can extract a zip file with known contents while deleting the extracted files in a loop, e.g.

A zip file, foo.zip with the content:

 bar.txt

Then, in a shell run a loop that triggers this race condition:

 $ while true; do rm bar.txt; done

In another shell, extract your files:

  AdmZip('foo.zip').extractAllToAsync(...)

This will then crash and take your node process with it, because the file will have been removed between the Utils.writeFileToAsync and fs.utimesSync calls.

This PR fixes this bug and will return an error when this condition occurs.

@cthackers cthackers merged commit cb300c9 into cthackers:master Oct 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants