Repository navigation
Conversation
DATAFRAG sampleSize is an untrusted header field. AssemblyBuffer::new used to pre-allocate and zero-fill a buffer of that size, up to nearly 4 GiB, from one short datagram. Reject sizes above the existing MAX_WITHHELD_BYTES_PER_TOPIC cap (16 MiB) and grow the buffer only as fragments arrive. This addresses public issue Atostek#462 item 1. The patch and the new unit test have not been compiled or run.
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.
Refs #462 (item 1).
DATAFRAG
sampleSize/data_sizeis taken from the submessage header and used inAssemblyBuffer::newto pre-allocate and zero-fill a buffer of that size (BytesMut::with_capacity+resize). A short datagram can claim up to about 4 GiB.MAX_ASSEMBLY_BUFFERSonly caps how many incomplete samples are kept per writer.This change rejects a claimed
data_sizeabove the existingMAX_WITHHELD_BYTES_PER_TOPICcap (16 MiB) and grows the buffer only as fragments arrive, instead of pre-filling the whole sample.This is a source-review patch. It has not been compiled or tested by us. CI and maintainer review should validate it; please compile and run the
fragment_assemblertests, including the newreject_oversized_data_sizetest, before merging.Ugur Celik (ucsurf), @ucsurf