Skip to content

Type-system bugs in ipfix.types (for_length, use_integer_ipv4, fixed-length strings, booleans, datetimes) #47

Open

Description

@britram

Pre-existing 0.9 bugs in ipfix/types.py (fixed in #34):

  • StructType.for_length() and OctetArrayType.for_length() passed self.roottype as the 6th positional argument (valstr) instead of roottype=self.roottype, leaving roottype as self and breaking .unparse(), .parse(), and roottype on every RLE type and fixed-length string/octetArray.
  • use_integer_ipv4() registered lowercase "ipv4address" instead of "ipv4Address", causing types.for_name("ipv4Address") to raise IpfixTypeError.
  • Fixed-length string did not strip trailing \x00 padding on decode and silently truncated oversized UTF-8 strings (potentially mid-codepoint) on encode.
  • _decode_smibool() treated any byte != 1 as False instead of rejecting values outside {1, 2} per RFC 7011 §6.1.5.
  • dt2epoch() crashed with TypeError on timezone-aware datetime values, and _parse_msec() / _parse_usec() crashed with ValueError on timestamps without fractional seconds.
  • OctetArrayType.decode_single_value_from() called .tobytes() on the buffer slice, crashing when passed bytes or bytearray instead of memoryview.
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions