Skip to content

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

Closed

Description

@JarryShaw

Describe the bug
A cut list of plain values reads the items past the capture as zeros. #2758 stopped this for lists of schema items, but the plain-value branch of ListField._unpack_items still reads on through the zero-fill. Every plain-value ListField is affected (IGMPv3 sources, IPv6-Route ip, HIP, MH, SCTP, IPv4, TCP, Radiotap), framed and standalone alike.

Reproduction

from pcapkit.protocols.internet.igmpv3.protocol import IGMPv3
rec = bytes([1,0,0,3, 224,0,0,1, 10,0,0,1, 10,0,0,2, 10,0,0,3])
rep = bytes([0x22,0,0,0,0,0,0,1]) + rec
[str(s) for s in IGMPv3(rep[:20]).info.records[0].sources]  # ['10.0.0.1', '0.0.0.0', '0.0.0.0']

Expected behavior
['10.0.0.1']: the list ends with the data, and only the item the cut lands inside reads its missing octets as zeros. This is the rule #2758 wrote into ListField.unpack. The rebuild must stay byte-exact (it is today).

System information
Linux, CPython 3.14.10, pcapkit 1.5.1 at c211805ae.

Additional context
Fix site: the plain-value branch of ListField._unpack_items, mirroring the schema branch. Makers that derive a count or length from the items (e.g. IPv6_Route._make_hdr_ext_len) must keep the declared value, as HTTPv2._make_http_settings does after #2758.

Activity

  1. added
    bugIssues reporting a defect (set by the bug report template; a default, not an assessment)
    pendingAccepted and unstarted - nobody is on it and nothing blocks it
    on Nov 4, 2026
  2. added this to the PyPCAPKit v1.6 milestone on Nov 4, 2026
  3. moved this to Pending in PyPCAPKiton Nov 4, 2026
  4. added
    wipWork in flight - a covering PR is open or an agent is actively on it
    and removed
    pendingAccepted and unstarted - nobody is on it and nothing blocks it
    on Nov 4, 2026
  5. moved this from Pending to WIP in PyPCAPKiton Nov 4, 2026
  6. removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssues reporting a defect (set by the bug report template; a default, not an assessment)

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions