Repository navigation
fix(schema): SMF_DPD option at the end of the header raises TypeError from smf_i_dpd_id_len - #1197
Merged
Merged
Conversation
… from smf_i_dpd_id_len Schema.unpack rewound a ForwardMatchField by its declared width rather than by the octets it actually read. At the end of the stream the read comes back short, so the rewind landed before the forward match and the fields after it re-read the preceding octet. An SMF_DPD option in the last two octets of a HOPOPT/IPv6-Opts header was therefore re-parsed from the PadN padding as Pad1, leaving len as NO_VALUE. Rewind by len(byte). The option now reaches the existing SMF I-DPD length guard and raises FieldValueError, as CALIPSO and MPL do. Closes #1195
Contributor
|
Coverage: 88.90% (unit tier, Python 3.14,
Per-file detail: the |
Owner
Author
|
Cross-review verdict on
|
JarryShaw
added a commit
that referenced
this pull request
Oct 7, 2026
Seven new entries and one extension in docs/source/changelog/1.5.0.rst, the regenerated CHANGELOG.md, and the process.rst entry-count pin re-measured (193 -> 200). The opening snapshot now cites 319 issues and pull requests up to #1195.
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) — not run; only the touched lines changedmake testpasses, and a test case covers the change — the modules listed below only, not the whole suiteWhat is the purpose of your pull request?
fix— corrects a defectCloses #1195. Root cause:
Schema.unpackrewound aForwardMatchFieldby its declared width, not by the octets it actually read._SMFDPDOption.testforward-matches 3 octets, but only 2 are left at the end of the header. The 3-octet rewind then re-parsed the option from the lastPadNpadding octet, asPad1, solenwas skipped and set toNO_VALUE. CALIPSO and MPL have no forward match, so they readlen=0and hit their length guards. The fix rewinds bylen(byte)(pcapkit/protocols/schema/schema.py). SMF_DPD now reaches the existingsmf_i_dpd_id_lenguard.hopopt.pyandipv6_opts.pyare unchanged.3b0001020000+0800TypeError: … 'NoValueType' and 'int'FieldValueError: invalid SMF I-DPD option length: 0Sweep: I placed every option type except RPL
0x23(#1196) at that position with len 0, in both classes. Before the fix,0x08raised a non-library exception in both. After it, none of the 510 cases does.Tests: the new
tests/protocols/internet/test_smf_dpd_truncated_len_unit.pyreports2 passed, 512 subtests passed. With the fix reverted it reports4 failed(SMF0x08in both classes). These all pass: the misc/schema/ipv6-ext/ipv4/mh/smf/mpl/qs/tcp/pcapng/option-roundtrip/option-coverage modules,tests/project(389 passed, 1 skipped), andrun_unittest_leg.py protocols/internet(493 test(s), 0 failure(s), 0 error(s)).