Skip to content

fix(ipv6-opts): SMF_DPD H-DPD with an empty hav raises IndexError instead of ProtocolError #1193

Closed

Description

@JarryShaw

Describe the bug
_make_opt_smf_dpd reads hav[0] with no length check, so an H-DPD option built with an empty hav raises a bare IndexError rather than ProtocolError. The access is at pcapkit/protocols/internet/hopopt.py:1678 on main; ipv6_opts.py has the same line.

To Reproduce
On origin/main (or the #1192 branch):
HOPOPT(next=59, options=[(Option.SMF_DPD, {'mode': SMFDPDMode.H_DPD, 'hav': b''})]) → IndexError: index out of range. IPv6_Opts behaves the same.

Expected behavior
An empty Hash Assist Value is rejected with an in-library ProtocolError naming the option, matching the other SMF_DPD validation errors.

The #1190 worker found this, and the #1192 cross-review reproduced it on both branches. I re-ran it on the #1192 branch.

Activity

  1. JarryShaw commented on Oct 7, 2026

    @JarryShaw
    OwnerAuthor

    Blocked until #1192 merges, because both edit hopopt.py and ipv6_opts.py.

  2. added
    fixPull requests that fix a defect (fix: subject prefix)
    blockedDeferred pending another issue or decision; see the last comment for what unblocks it
    on Oct 7, 2026
  3. JarryShaw commented on Oct 7, 2026

    @JarryShaw
    OwnerAuthor

    Unblocked: #1192 merged. A worker is on it now.

  4. added
    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
    on Oct 7, 2026
  5. removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Oct 7, 2026
  6. 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