Skip to content

fix(foundation): a record length above sys.maxsize crashes Frame.read with OverflowError on 32-bit-Py_ssize_t builds #1975

Closed

Description

@JarryShaw

A crafted PCAP whose record header declares incl_len of 2**31 - 16 or more crashes Frame.read with OverflowError. This happens on any build where sys.maxsize is 2**31 - 1: GraalPy and 32-bit CPython. The declared length goes straight into a read or seek that takes a Py_ssize_t, so the overflow fires before the existing short-read handling can reject the record.

It was found while sorting #1963's GraalPy failures. #1974 only gates the two #1541 subtests that hit it, skipping the claims above sys.maxsize. The pcapkit side is unfixed.

Fix: audit every read and seek driven by a declared length in the PCAP and PCAPNG engines. Clamp or reject claims above what a single read can take, so a hostile claim gets the same malformed-record handling on every build. Then lift the #1974 gate.

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. 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
  3. JarryShaw commented on Oct 20, 2026

    @JarryShaw
    OwnerAuthor

    Blocked until #1974 merges, since the gate this fix lifts lives there.

  4. moved this to Blocked in PyPCAPKiton Oct 20, 2026
  5. JarryShaw commented on Oct 20, 2026

    @JarryShaw
    OwnerAuthor

    #1974 has merged, so this is unblocked. A worker is auditing the PCAP and PCAPNG length-driven reads and seeks, handling claims above sys.maxsize as overruns on every build, and lifting #1974's gates on the two #1541 subtests.

  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