Repository navigation
fix(protocols): record a cut option area or SCTP padding where the data ends (#2680) - #2682
Conversation
|
NEEDS CHANGES: wrong layer. The rework removes the cap so the built-in records the cut, which also fixes a chunk schema on its own. It drops this PR's separate padding check in the |
4c4b0a3 to
c4e9af7
Compare
|
Pushed the rework,
A Sonnet re-review is running. |
|
NEEDS CHANGES at
The scoped hook is the right shape: it declares a policy and leaves recording to the built-in. Its scoping is not pinned, though:
|
…ta ends (#2680) Schema.unpack gave back a cut OptionField area's remainder by its declared width, keeping and rewinding octets never read, and charged the cut to the field before it parsed; #2679's SCTP.unpack override worked round that for SCTP alone and could not read a stream that does not seek. padding_length capped SCTP padding at the octets left, so a chunk cut inside it packed at full width: 34 octets in, 36 out. - Schema.unpack gives back no more of the remainder than it read, and charges the cut to the option field only when none is given back. - ChunkListField reports its remainder in declared terms; the override is gone. - padding_length returns the padding the Length calls for. OptionField.unpack asks _accepts_short_read before refusing a short option (#1325), and refuses by default, since a general padding rule accepts the PadN overruns #1325 refuses; PaddedOptionField accepts SCTP's, which the Length leaves out. - Tests: SCTP items cut at every padding offset, alone, nested and bundled, on bytes, streams and envelopes; a TCP option area cut at every offset; SCTP on a stream that cannot seek; an SCTP item overrunning its chunk, still refused; an option reporting more than it read. #2679's tests pass unchanged. Every unittest leg passes; captures parse identically to main. Closes #2680 Closes #2685
c4e9af7 to
acf8920
Compare
|
GOOD TO GO at
|
|
Coverage: 94.42% (unit tier, Python 3.15,
Per-file detail: the |
… helpers, MH options 6 and 27, the cut SCTP and option-area schemas and dict-built secrets into 1.6.0 (#2449) - Breaking: a make() enumeration field takes a member or an int, its X_default/X_namespace/X_reversed keywords removed with no alias, and names, wide codes and wide option codes are refused (#2692); the schema helpers move to pcapkit.corekit.schema and pcapkit.corekit.fields.byteorder is removed (#2704); MobileNetworkPrefixOption gains prefix_length and keeps an IPv6Address prefix, and TimestampOption's timestamp is None past 9999 (#2709). Folded into the MH data-model entry; old values measured against v1.5.1. - Fixed: the SCTP schema cut inside its padding and a header schema cut inside an option area pack back as captured (#2682), into the SCTP entry; a Decryption Secrets Block rebuilds from its dict as captured (#2707), into the DSB entry. - Folded into unreleased entries: FRAD's Q.922 address refusal and quiet cut rebuild (#2719); a from_data rebuild's checksum status (#2712); a failed ListField fill's ledger (#2706); pad_length's path (#2704); TLS's enumeration fields (#2692); the make() and schema-helper rulings, into the conventions entry (#2692, #2704); the GraalPy shards, into the CI-legs entry (#2720). - 1.5.0's corekit.fields.byteorder role points at corekit.schema.byteorder, where #2704 moved it, so the nitpicky build does not warn on it; 1.5.0's text unchanged. - No entry for the test-only 72b2bd8 (#2715), or the docs-and-test-only 0c07940 (#2718). - CHANGELOG.md regenerated; util/changelog_md.py --check passes.
make pylint,make mypy,make isort)make testpasses, and a test case covers the changeWhat is the purpose of your pull request?
fix— corrects a defectDescription of your pull request and other information
SCTP's capture cuts now go through
Schema's built-in short read, with no per-protocol override.padding_lengthno longer caps the padding at the octets left. A chunk, parameter or cause cut inside its padding now reads short.Schema.unpackrecords the cut on the innermost item, andpack()writes back the octets read at every level. Before, the SCTP schema packed 34 octets in as 36, andDATAChunk22 as 24.Schema.unpack'sOptionFieldhand-back gives back no more of a cut option area's remainder than it read. It records the cut on the option field only when nothing is given back.ChunkListFieldreports its remainder against the declared area, as other option fields do. This fixes the same defect seen at schema level in TCP.Schema_SCTP.unpackoverride is removed. fix(transport): rebuild an SCTP packet cut short of its envelope's length (#2673) #2679's tests pass unchanged without it, and a non-seekable stream with a length parses again.OptionField._accepts_short_read. It refuses by default. SCTP'sPaddedOptionFieldaccepts only a short read confined to an item's padding, which RFC 9260 leaves out of the Length.Cut sweeps over every padding offset (bytes, streams, IPv4 and IPv6), standalone chunk schemas, and a TCP option area cut at every offset all fail on
main. Every leg passes, apart from the CI-script failuresmainalso has. Shipped captures are identical tomain.Closes #2680
Closes #2685