Skip to content

fix(protocol): a raw-bytes or Schema item in a make() list crashes construction #1312

Closed

Description

@JarryShaw

Describe the bug
Protocol.__init__ stores the made schema in __header__ (protocol.py:573) and unpack then reuses it instead of re-parsing (protocol.py:593-596), so read receives items still as bytes/Schema. The bytes/Schema items that _make_hip_param, _make_ipv4_options and _make_mh_options accept are not readable by read.

To Reproduce

  • HIP(extension=True, parameters=[b'\x00\x41\x00\x08' + bytes(8)]): AttributeError: 'bytes' object has no attribute 'type' at hip.py:786
  • IPv4(options=[b'\x94\x04\x00\x00'], protocol=253): same error at ipv4.py:621
  • MH(data={'options': [b'\x01\x02\x00\x00']}): same at mh.py:2824
  • bare MH(): 'bytes' object has no attribute 'options' at mh.py:1678 (the default is data=b'\x00\x00', mh.py:1448)

Expected behavior
Items the makers accept build a packet, and a bare MH() constructs. Either re-parse the packed header in unpack or have read accept the made schema.

Found by the internet-v4 round-trip audit (#1202); reproduced on main at 11ae68ebf (repro check D1).

Found by the internet-v4 round-trip audit (#1202). The repro was re-checked by an independent verifier, and I re-ran it on main at 11ae68ebf.

Activity

  1. added
    fixPull requests that fix a defect (fix: subject prefix)
    pendingAccepted and unstarted - nobody is on it and nothing blocks it
    blockedDeferred pending another issue or decision; see the last comment for what unblocks it
    and removed
    pendingAccepted and unstarted - nobody is on it and nothing blocks it
    on Oct 7, 2026
  2. JarryShaw commented on Oct 7, 2026

    @JarryShaw
    OwnerAuthor

    Unblocked: #1227 merged at 19:06Z, so the file conflict is gone. Back to pending until a worker picks it up.

  3. added
    pendingAccepted and unstarted - nobody is on it and nothing blocks it
    wipWork in flight - a covering PR is open or an agent is actively on it
    and removed
    blockedDeferred pending another issue or decision; see the last comment for what unblocks it
    pendingAccepted and unstarted - nobody is on it and nothing blocks it
    on Oct 7, 2026
  4. removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Oct 7, 2026
  5. added this to the PyPCAPKit v1.5 milestone on Oct 25, 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

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

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions