AisParser icon indicating copy to clipboard operation
AisParser copied to clipboard

Validation of Payload length

Open chelliwell opened this issue 5 years ago • 0 comments

Hi, I've got <1 day experience with your library, but it's looking good so far! I quickly catapulted a project together today for our system [we get raw AIS bytes, so I'm side-stepping the NMEA sentence parsing] and noticed that it seems possible to chuck invalid messages at it - e.g. a Message type 5 with only 2 bytes. With many (all?) of the AIS message types being defined as a fixed numbers of bits, I was wondering if AisParser should throw if the Payload is too short (or too long) for the message type indicated by the first byte? I've only been reading AIS spec for a couple of weeks, so apologies if I've over-simplified, but just looking to ensure catching rogue/corner cases in our code too. 'For discussion', not a criticism ;)

chelliwell avatar Jan 27 '20 18:01 chelliwell