Skip to content

fix(hip): make() rounds Header Length down for an unpadded raw parameter #1313

Closed

Description

@JarryShaw

Describe the bug
length = total_length // 8 + 4 (hip.py:654) assumes every parameter is already 8-octet aligned, but the bytes branch of _make_hip_param (hip.py:2968-2970) neither pads nor validates the item.

To Reproduce
HIP.__new__(HIP).make(parameters=[b'\x00\x41\x00\x08' + bytes(8)]).pack() (a 12-octet parameter; the constructor path is blocked by D1): Header Length byte is 5 but 52 octets are packed (48 would be consistent). A 7-octet raw parameter gives 4 and 47 octets.

Expected behavior
Pad the raw parameter to a multiple of 8, or reject an unaligned one with ProtocolError.

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

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
    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
  2. removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    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