Repository navigation
fix(ipv4,tcp)!: a header length declared past the data zero-fills on rebuild; TS make() rejects string address keys (#1402, #1404) - #1411
Merged
Conversation
Contributor
|
Coverage: 89.40% (unit tier, Python 3.14,
Per-file detail: the |
Owner
Author
|
Cross-review verdict on
Everything else holds:
PR body: |
…rebuild; TS make() rejects string address keys (#1402, #1404) - IPv4.read() and TCP.read() raise ProtocolError when ihl / Data Offset declares more header than the data holds, so the parent keeps the octets as a Raw payload and rebuilds them byte for byte (#1404). - IPv4._make_opt_ts() converts timestamp address keys with parse_ip_address(version=4) instead of int(), so a dotted-quad string works like an IPv4Address and a bool raises FieldValueError (#1402). - Tests that pinned the zero-filling parse now pin the refusal, and keep #431's end-of-option-list loop pinned at the schema level. The IPv4 option-overrun fixtures get a complete header plus payload, so they still reach #1325's option check, and each check is asserted on its own message. Closes #1402 Closes #1404
JarryShaw
force-pushed
the
fix/1402-1404-ipv4-tcp
branch
from
October 8, 2026 04:34
e115868 to
98c97bf
Compare
Owner
Author
|
Delta verdict on
|
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.
make pylint,make mypy,make isort) — mypy clean on both files; isort flags only pre-existing wrapping; pylint not runmake testpasses, and a test case covers the change — legsprotocols/internet559/0/0,protocols --exclude protocols/internet1025/0/0,integration186/0/0;tests/project399 passed, 1 skippedWhat is the purpose of your pull request?
fix— corrects a defectDescription of your pull request and other information
IPv4.read()/TCP.read()(ipv4.py:328,tcp.py:515) raiseProtocolErrorwhenihl/ Data Offset exceeds the data, so the parent keeps a Raw payload. Ethernet+IPv4ihl=6, 20 octets: 34 → 38 before, 34 → 34 after; TCP offset 6 in IPv4: 54 → 62 before, exact after._make_opt_tsconverts address keys withparse_ip_address(..., version=4)on both paths.'1.2.3.4'builds likeIPv4Address('1.2.3.4');TrueraisesFieldValueError.ProtocolErrorinstead of parsing with zero-filled options. TSmake()now refuses keysmainsilently coerced withint():bool,float,IPv6Address, and digit strings such as'16909060'(allFieldValueError).tests/protocols/test_ipv4_tcp_header_overrun_unit.py. Three tests that pinned the zero-fill parse now pin the refusal: fix(protocols)!: a declared length running past the data is accepted and zero-filled on rebuild #1398's..._still_ends_at_eool(renamed..._is_kept_as_captured, asserts the round trip), plus the IPv4/TCP..._still_parsestests, which keep OptionField.unpack never returns for a well-formed HOPOPT header with an SMF_DPD option #431's EOOL loop pinned through the schema. Withipv4.py/tcp.pyfromorigin/main: 13 failed, 6 passed, plus 2 failed in the IPv4/TCP unit modules.has an option that runs past; the header check is asserted separately onheader length N runs past. With pre-fix(protocols): a declared length running past the data is accepted and zero-filled on rebuild #1325collections.py(6f4bf9dc8^) those option-check assertions fail, the IPv4 ones included.Closes #1402
Closes #1404