Conversation
Collaborator
|
Needs rebase. |
USCMig
force-pushed
the
fix-memforest-deserialize-untrusted
branch
from
September 24, 2026 03:36
3e55267 to
04c45d0
Compare
Author
|
new commit to cleanly merge |
Collaborator
|
CI is red. |
…king `serialize` returns `io::Result<()>` and uses `?` for the two length prefixes, but then `unwrap()`ed the result of writing each root. A writer that fails partway -- a full disk, a closed pipe, a socket that went away -- panics rather than returning the `Err` the signature promises. Separate from the deserialize fixes in the previous commit and safe to take on its own: this one is about a failing writer, not untrusted input.
USCMig
force-pushed
the
fix-memforest-deserialize-untrusted
branch
from
October 4, 2026 04:08
04c45d0 to
940ce48
Compare
Author
|
Fixed CI issue and it green, ready to merge. Thanks! |
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.
MemForest::serializepanics on a failing writerRebased onto
main. The deserialize fixes this PR originally carried landedindependently in 69484de ("apply fixes for bugs found while fuzzing"), so that
commit is dropped. What remains is the one fix
maindoesn't have yet.serializereturnsio::Result<()>and?s its two length prefixes, but thenunwrap()s the result of writing each root:A writer that fails partway (a full disk, a closed pipe, a socket that went
away) panics instead of returning the
Errthe signature promises. The fix is?.Testing
test_serialize_reports_writer_errorsserializes a forest into a writer withroom for the two length prefixes but not for the roots. It expects
ErrorKind::WriteZero, then checks that the same forest still serializes intoan unbounded writer.
Reverting the fix makes exactly this test fail, and it panics at
src/mem_forest/mod.rs:271.cargo test --all-featurespasses (105 tests).cargo clippy --all-targets --all-featuresis clean, and so iscargo +nightly fmt --check. There is nopublic API change, and no behaviour change for any writer that succeeds.
A note on 69484de, not a request
mainbounds_read_oneatdepth > MAX_FOREST_ROWS + 1. A root has at mostMAX_FOREST_ROWSrows, so its leaves are at most that many levels down, and> MAX_FOREST_ROWSis the tight bound. The+ 1is harmless, since therecursion is bounded either way. I'm mentioning it only because the tighter
form was in this PR before the rebase.