CAIDA / libparsebgp

Lightweight parser for binary BGP, BMP and MRT routing data
https://bgpstream.caida.org
BSD 2-Clause "Simplified" License
8 stars 8 forks source link

Better handling of corrupted TABLE_DUMP messages #41

Closed alistairking closed 6 years ago

alistairking commented 6 years ago

Previously we had an assert in place to ensure that the number of bytes parsed from a TABLE_DUMP message was the same as the length reported in the MRT header. It seems however that there are corrupted data files where the reported length is longer than the actual data. This commit changes the assert to the standard invalid message macro in this case (it leaves the assert for the case where the number of bytes read is more than the reported message length, though this could possibly cause a similar problem).

See the inline comments about how I decided to try and skip over the remainder of the message if the user has asked to struggle on in the face of invalid data.