Skip to content

fix(pcapng): an unknown, custom or journal block cut off past the zero-pad limit aborts extraction #1984

Closed

Description

@JarryShaw

An unknown block, a Custom Block or a systemd journal export block whose Block Total Length is above config.MAX_ZERO_PAD_LENGTH (0x40000) and runs past the end of the file aborts extract. Every earlier frame is lost.

  • Repro (on main, engine='default'): build SHB + IDB + EPB + struct.pack('<II', 0x77, 0x7FFFFFF0) + bytes(8). Block types 9 and 0xBAD fail the same way.
  • Result: FieldValueError: Field body declares a length of 2147483620 octet(s)…, raised from Schema.unpack. The failing field is body, data or entry, depending on the block type.
  • Contrast: EPB, IDB, ISB, NRB and SPB in the same position are rescued by PCAPNG.read's _read_block_cut fallback. So are these three block types when the length is below the zero-pad limit, for example 0x10000.

Fix: cut a block that the file truncates the same way for every type, so its fields are sized from the octets actually held, and extraction keeps the frames before it.

Found while reviewing #1983 (#1980).

Activity

  1. added
    bugIssues reporting a defect (set by the bug report template; a default, not an assessment)
    fixPull requests that fix a defect (fix: subject prefix)
    pendingAccepted and unstarted - nobody is on it and nothing blocks it
    on Oct 20, 2026
  2. JarryShaw commented on Oct 20, 2026

    @JarryShaw
    OwnerAuthor

    Blocked until #1979 merges. The fix belongs in PCAPNG.read's block-cut path, which #1979 is rewriting.

  3. added
    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 20, 2026
  4. moved this to Blocked in PyPCAPKiton Oct 20, 2026
  5. JarryShaw commented on Oct 20, 2026

    @JarryShaw
    OwnerAuthor

    #1979 has merged, so this is unblocked. A worker has started.

  6. 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 20, 2026
  7. moved this from Blocked to WIP in PyPCAPKiton Oct 20, 2026
  8. removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Oct 20, 2026
  9. added this to the PyPCAPKit v1.5 milestone on Oct 26, 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)fixPull requests that fix a defect (fix: subject prefix)

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions