Skip to content

fix(schema): SMF_DPD option at the end of the header raises TypeError from smf_i_dpd_id_len #1195

Closed

Description

@JarryShaw

Describe the bug
When an SMF_DPD option sits in the last two bytes of a HOPOPT or IPv6-Opts header, parsing it raises a bare TypeError instead of an in-library error. The ConditionalField skips len, so pkt['len'] is the NO_VALUE sentinel, and smf_i_dpd_id_len subtracts from it without a guard. This happens at pcapkit/protocols/schema/internet/hopopt.py:159, and schema/internet/ipv6_opts.py:159 has the same line.

To Reproduce
On origin/main (a2f989fbd), run HOPOPT(io.BytesIO(bytes.fromhex('3b00010200000800'))). It raises TypeError: unsupported operand type(s) for -: 'NoValueType' and 'int'. IPv6_Opts behaves the same way.

Expected behavior
A truncated option raises an in-library error, as its siblings already do. CALIPSO (…0700) raises FieldValueError: invalid CALIPSO option length: 0, and MPL (…6d00) raises the equivalent MPL error.

The #1193 worker found this, and the #1194 cross-review reproduced it. That review swept all 256 option types at that position, and only type 8 raises TypeError. I re-ran it on main.

Activity

  1. JarryShaw commented on Oct 7, 2026

    @JarryShaw
    OwnerAuthor

    A worker is on it now.

  2. 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 Oct 7, 2026
  3. added
    fixPull requests that fix a defect (fix: subject prefix)
    wipWork in flight - a covering PR is open or an agent is actively on 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 a commit that references this issue on Oct 7, 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

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions