Fix handling of local file header for 3TZ #173
Merged
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.
There have been reports of 3TZ files that could not be read due to improper handling of the "extras" field in local file headers. The 3TZ reading functions simply assumed that the "extras" are at most 48 bytes (and I don't know where this value came from). But certain files that had been accessed with certain tools could contain extras that contained more than 48 bytes (in a "Windows NT Security Descriptor Extra Field", see specs).
The change here removes the assumption of these 48 bytes. The archive functions now explicitly look at the actual size of the extras field in the header, and then use this to compute the offset at which the actual file data can be read.
I'm opening this as a "draft" for now. I'd like to add some tests/specs. But in terms of 3TZ, there currently is zero test coverage, and I don't know how the problematic files had been created, so it's not entirely clear how the test coverage could sensibly be increased here...