Fix corpus archiving#2117
Open
q9982 wants to merge 1 commit into
Open
Conversation
…ata` during experiments when files change while the tar archive is being created. Corpus files can still change while the runner is creating a tar archive. Adding them directly from disk can therefore write a tar header for one size and then read a different amount of data, producing a truncated tar member. Stage regular files in a temporary file before writing them to the tar archive. Non-regular entries only need their tar header, so avoid reading file contents for them.
Author
|
We have reproduced the issue using a deliberately designed fuzzer; see q9982@f889f7a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix corpus archiving to avoid
tarfile.ReadError: unexpected end of dataduring experiments when files change while the tar archive is being created.Corpus files can still change while the runner is creating a tar archive. Adding them directly from disk can therefore write a tar header for one size and then read a different amount of data, producing a truncated tar member.
Stage regular files in a temporary file before writing them to the tar archive. Non-regular entries only need their tar header, so avoid reading file contents for them.