Skip to content

fix(corekit): end a cut list of plain values with the data, not in zero-filled items (#2760) - #2766

Merged
JarryShaw merged 1 commit into
mainfrom
fix/2760-plain-list-phantom-items
Nov 4, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
fix/2760-plain-list-phantom-items

Conversation

@JarryShaw

Copy link
Copy Markdown
Owner

What is the purpose of your pull request?

  • fix — corrects a defect

Description of your pull request and other information

#2758 stopped schema-item lists from reading past the capture. Lists of plain values still did: a cut IGMPv3 sources gave ['10.0.0.1', '0.0.0.0', '0.0.0.0']. All 37 plain-value ListFields did the same: HIP, IGMPv3, IPv4, IPv6-Route, MH, Radiotap, SCTP and TCP.

  • ListField._unpack_items now stops a plain list at the captured octets. The item the cut lands inside zero-fills itself, as any field does.
  • A plain list read inside a zero-filled schema item gets the same boundary through a new __data_present__ key. _give_back_fill returns the unread zeros to the padding budget.
  • A new __zero_tail__ key keeps feat(link): decode radiotap TLV items a producer cut short #2655: a Radiotap TLV that a producer left short still reads its missing octets as zero items.
  • IGMPv3 Data_Query gains num_sources, and make() gains a num_sources keyword. An unedited cut keeps its declared count and an edited one recounts, so every rebuild stays byte-exact from both info and to_dict().
  • The three new test modules fail on main (757, 246 and 68 failures) and pass here. One IGMP test that pinned the zero sources is adapted.

Closes #2760

…ro-filled items (#2760)

A cut ListField of plain values read on past the data, each item zero-filled, so a cut
IGMPv3 group record held its counted sources as 0.0.0.0. It now ends with the data as a
list of schema items has done since #2756; the item the cut lands inside reads zeros past it.

- ListField._unpack_items stops a plain list at the octets present; a length no whole
  number of items fills is still refused.
- An item read from a list's zero fill hands the fill's start on through Schema.unpack
  (__data_present__), so a list in it ends with the data; unread fill goes back to the ledger.
- Radiotap passes __zero_tail__ for a short TLV item, whose missing octets are zeros (#2655).
- IGMPv3 Query data gains num_sources and make() a num_sources keyword; _make_data keeps the
  count of an unedited cut source list and lets make() count edited sources.

Tests failing on c211805: every plain-value list cut at every offset; IGMPv3, IPv6-Route.
@JarryShaw JarryShaw added fix Pull requests that fix a defect (fix: subject prefix) review: running A cross-review is in flight against the current head - no verdict yet labels Nov 4, 2026
@JarryShaw JarryShaw moved this to In review in PyPCAPKit Nov 4, 2026
@github-actions github-actions Bot added this to the PyPCAPKit v1.6 milestone Nov 4, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

GOOD TO GO at bba587826 (Sonnet cross-review, and my own run of the new tests)

  • Boundary: a cut IGMPv3 or IPv6-Route list at every offset gives no item made only of zero-fill, keeps the item the cut lands in, and rebuilds byte-exact from both info and to_dict().
  • Budget: a plain list nested three deep in zero-filled items never spends past its starting allowance, and the raise path restores it. __data_present__ and __zero_tail__ never appear in info or to_dict(). The Radiotap feat(link): decode radiotap TLV items a producer cut short #2655 tests pass.
  • IGMPv3 Query: num_sources is kept for an unedited cut and recounted after an edit. make(num_sources=...) rejects counts below the sources or above 16 bits.
  • Tests: the three new modules fail on main (757, 246 and 68 failures). Project tests, Lint and deploy-pages pass.
  • Not exercised directly: a real TCP or SCTP cut. Those lists are covered by the schema-level sweep.

@JarryShaw JarryShaw added review: good-to-go Cross-review at the current head says ready; CI state is separate and removed review: running A cross-review is in flight against the current head - no verdict yet labels Nov 4, 2026
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Coverage: 94.45% (unit tier, Python 3.15, bba587826, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 106 4 20 2 95.24%
pcapkit/const 20918 175 2908 156 98.57%
pcapkit/corekit 2913 77 940 38 96.81%
pcapkit/dumpkit 286 3 102 3 98.45%
pcapkit/foundation 3507 27 1216 32 98.75%
pcapkit/interface 138 4 52 3 96.32%
pcapkit/protocols 22784 157 5928 127 99.00%
pcapkit/toolkit 961 26 342 8 96.62%
pcapkit/utilities 559 7 150 5 98.31%
pcapkit/vendor 5590 2286 1280 214 55.75%

Per-file detail: the coverage-html artifact of this run.

@JarryShaw
JarryShaw merged commit ff103c1 into main Nov 4, 2026
70 checks passed
@JarryShaw
JarryShaw deleted the fix/2760-plain-list-phantom-items branch November 4, 2026 17:16
@github-project-automation github-project-automation Bot moved this from In review to Done in PyPCAPKit Nov 4, 2026
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Nov 4, 2026
JarryShaw added a commit that referenced this pull request Nov 4, 2026
- #2766 (Fixed): a cut list of plain values ends with the data, where 1.5.x
  read zero values past the cut (a cut Type 0 Routing header, measured on
  v1.5.1), into the ListField entry; IGMPv3's sources and the Query's
  num_sources, into the IGMP entry.
- #2767: a cut header rebuilt on its own reads back its parsed values, a
  regression of the 1.6.0 rebuild path, into the cut-header Fixed entry; the
  round-trip test rule, into the conventions entry.
- #2764: SSLv2, TLS and DTLS records rebuild from their to_dict(), into the
  TLS/DTLS Added entry, as those classes never shipped.
- #2765: the further member reorders and guard rules, into the member-order
  entry, which records the earlier #2490 reorders.
- CHANGELOG.md regenerated; util/changelog_md.py --check passes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Pull requests that fix a defect (fix: subject prefix)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

fix(corekit): a cut list of plain values reads the items past the capture as zeros

1 participant