fix: refuse to create entries inside a stream - #84
Open
francisdb wants to merge 2 commits into
Open
Conversation
Creating a stream or storage resolved its parent by name without checking that the parent is a storage. With a stream named `a`, creating `/A/child` hung the new entry off the stream's directory entry as its child, which strict validation (and other readers) reject. The parent must now be a storage; otherwise the call fails with InvalidInput. Found by a fuzz target that drives the write API.
Creates, overwrites and removes streams and storages under names taken from the fuzz input (including names that differ only in case), then reopens the result under strict validation and checks every entry and its content against a model of what should be there.
mdsteele
reviewed
Sep 8, 2026
| let cursor = Cursor::new(Vec::new()); | ||
| let mut comp = CompoundFile::create(cursor).unwrap(); | ||
| comp.create_stream("/a").unwrap().write_all(b"data").unwrap(); | ||
| let err = match comp.create_stream("/A/child") { |
Owner
There was a problem hiding this comment.
Could this just be let err = comp.create_stream("/A/child").unwrap_err();, similarly to below?
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.
Creating a stream or storage did not check that the parent is a storage. Names compare case-insensitively, so with a stream
ain the root,create_stream("/A/child")hung the new entry off the stream's directory entry as a child, which strict validation (and other readers) reject.create_stream,create_new_streamandcreate_storagenow fail withInvalidInputwhen the parent is a stream.Found by the new
fuzz_writetarget in the second commit, which drives the write API and reopens the result under strict validation; it runs clean with the fix.