Repository navigation
fix(reassembly): only the final fragment's partial block counts, and an oversized datagram never completes (#1566, #1567) - #1582
Merged
Conversation
…an oversized datagram never completes (#1566, #1567) - #1566: both completion checks tested all(RCVBT[0:(TDL + 7) // 8]), a slice that stops at the table's end, so a datagram declaring more data than the 65,535-octet buffer completed short. One helper, IP._is_complete, now also requires TDL <= len(datagram). - #1566: strict mode dropped a datagram with no run received while lax mode reported it. Both now report it, strict with payload (). - #1567: a non-final fragment ending mid-block marked that block, so a snaplen-cut IPv6 fragment (tl comes from the captured payload) completed its datagram zero-filled. Only the final fragment's partial last block is marked now; this replaces #1564's Total Length 0 special case and also covers a malformed IPv4 one. A fragment the buffer's end clips stays counted as cut there, so 7 and 8 octets at offset 65,528 now agree. Sample-capture reassembly is unchanged (9,456 rows, default/dpkt/scapy).
Owner
Author
|
Verdict: GOOD TO GO at
Non-blocking, filed as #1585 (blocked on this PR):
|
Contributor
|
Coverage: 89.63% (unit tier, Python 3.14,
Per-file detail: the |
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.
Please follow the guide below
You will be asked some questions, please read them carefully and answer honestly
Put an
xinto all the boxes [ ] relevant to your pull request (like that [x])Use Preview tab to see how your pull request will actually look like
Searched for similar pull requests
Followed the coding style (
make pylint,make mypy,make isort)make testpasses, and a test case covers the changeAdded a changelog entry under
docs/source/changelog/and regeneratedCHANGELOG.md, if the change is user-visible — N/A — centralised in docs(changelog): shared 1.5.0 changelog — long-lived, merges last (#610, #616, #617, #618, #620) #657What is the purpose of your pull request?
Tick the commit type your subject line carries.
fix— corrects a defectfeat— adds a featureperf— changes performance, not behaviourrefactor— changes neither behaviour nor performancetest— tests onlydocs— documentation onlyci— workflows or build toolingrelease— bumps the version or rolls up a distributionchore— anything elseDescription of your pull request and other information
Closes #1566. Closes #1567.
The code change is in
pcapkit/foundation/reassembly/ip.pyonly; no toolkit adapter is touched.IP._is_complete, which also requiresTDL <= len(datagram). The issue's candidate,(TDL + 7) // 8 <= len(RCVBT), still passes TDL 65,536 asCOMPLETEwith 65,535 octets. A test covers that case.payload=(), as lax mode already does.PARTIALwith a hole, under the default (pcap and pcapng), dpkt and scapy engines.Sample-capture reassembly is byte-identical to
main: 9,456 rows across default, dpkt and scapy, in both modes.