Skip to content

MessageBuffer and Template protocol and exception edge-case bugs #50

Open

Description

@britram

Pre-existing 0.9 bugs across ipfix/message.py, ipfix/template.py, and ipfix/types.py (fixed in #34):

  • MessageBuffer.begin_export(0) ignored odid=0 (if odid:) and looked up self.sequence for the previous ODID before updating self.odid.
  • Template.identical_to() ignored IE lengths (# FIXME this needs to check IE lengths as well), treating differently sized IEs with the same PEN and element ID as identical.
  • MessageBuffer.export_template() omitted the 4- or 6-byte template header size in its MTU check, and export_new_set() omitted MTU checks for setid < 256.
  • Template.encode_to() raised ValueError instead of EndOfMessage (via struct.error) when a variable-length field overflowed self.mbuf.
  • template.decode_template_from() accepted invalid Options Template scopecount values (0 or > count).
  • MessageBuffer._increment_sequence() did not wrap sequence numbers modulo 2**32, causing struct.pack_into("!HHLLL", ...) to fail on 32-bit overflow.
  • Custom exceptions (IpfixTypeError, IpfixEncodeError, IpfixDecodeError, EndOfMessage) used super(self.__class__, self).__init__(args), causing infinite recursion on subclassing and double-wrapping e.args.
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