Repository navigation
Verify ZIP symlink data only after its bounds check in PureLib - #6675
Merged
AmirMS (AmelBawa-msft) merged 2 commits intoNov 12, 2026
Merged
AmirMS (AmelBawa-msft) merged 2 commits into
AmirMS (AmelBawa-msft) merged 2 commits into
Conversation
| if (lfh_offset > size) return PURE_E_ZIP_LFH_DATA_OVERFLOW; | ||
| // Verify symlink data only after checking that it is within the buffer: | ||
| { | ||
| int error = pure_zip_verify_symlink(&cdh, &lfh, buffer); |
Contributor
There was a problem hiding this comment.
Has anyone looked at submitting this as an official patch to the upstream?
Contributor
Author
There was a problem hiding this comment.
Good question! Upstream hasn't been active since 2020, so I went with a local fix for now.
JohnMcPMS
approved these changes
Nov 12, 2026
ranm-msft
approved these changes
Nov 12, 2026
ranm-msft
left a comment
Contributor
There was a problem hiding this comment.
Bounds checks now run before symlink target validation. The valid-symlink and one-byte-past-end cases cover the intended behavior. Looks good.
AmirMS (AmelBawa-msft)
deleted the
user/amelbawa/fix-zip-symlink-bounds
branch
November 12, 2026 04:59
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.

📖 Description
pure_zip_metaafter the existing bounds check, so symlink data is only read once it's known to be within the buffer. Valid archives behave the same.pure.hand a "Local changes" section to the PureLib readme, so these changes are kept on future subtree updates.🔗 References
🔍 Validation
✅ Checklist
🤖 AI Assistance
📋 Issue Type
Microsoft Reviewers: Open in CodeFlow