Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic when messages are truncated #149

Closed
digizeph opened this issue Feb 8, 2024 · 1 comment
Closed

Panic when messages are truncated #149

digizeph opened this issue Feb 8, 2024 · 1 comment

Comments

@digizeph
Copy link
Member

digizeph commented Feb 8, 2024

bgpkit-parser https://archive.routeviews.org/bgpdata/2001.10/UPDATES/updates.20011027.0033.bz2

stack backtrace:
0: _rust_begin_unwind
1: core::panicking::panic_fmt
2: bytes::bytes::Bytes::split_to
3: bgpkit_parser::parser::bgp::messages::parse_bgp_update_message
4: bgpkit_parser::parser::bgp::messages::parse_bgp_message
5: bgpkit_parser::parser::mrt::messages::bgp4mp::parse_bgp4mp_message
6: bgpkit_parser::parser::mrt::messages::bgp4mp::parse_bgp4mp
7: bgpkit_parser::parser::mrt::mrt_record::parse_mrt_body
8: bgpkit_parser::parser::mrt::mrt_record::parse_mrt_record
9: <bgpkit_parser::parser::iters::RecordIterator as core::iter::traits::iterator::Iterator>::next
10: <bgpkit_parser::parser::iters::ElemIterator as core::iter::traits::iterator::Iterator>::next
11: bgpkit_parser::main

Potential cause of the panic:

let withdrawn_bytes = input.split_to(withdrawn_bytes_length);

We should not assume we can always get enough bytes from the data source. bytes.split_to will panic if not enough bytes available.

@digizeph
Copy link
Member Author

digizeph commented Feb 8, 2024

bgpkit-parser@0.10.0-beta.3 addressed this issue.

bgpkit-parser https://archive.routeviews.org/bgpdata/2001.10/UPDATES/updates.20011027.0033.bz2 | wc -l
  235253

@digizeph digizeph closed this as completed Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant