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 on GRASP message with empty option #3

Open
mcr opened this issue Mar 22, 2021 · 0 comments
Open

panic on GRASP message with empty option #3

mcr opened this issue Mar 22, 2021 · 0 comments

Comments

@mcr
Copy link
Contributor

mcr commented Mar 22, 2021

via Brian E Carpenter

One more panic:
thread 'tokio-runtime-worker' panicked at 'index out of bounds: the len is 0 but the index is 0', src/grasp.rs:161:11

That's on this statement:

match ctarray[0] {
    CborType::Integer(O_IPV6_LOCATOR) => grasp_parse_ipv6_locator(ctarray),
    CborType::Integer(O_IPV4_LOCATOR) => grasp_parse_ipv4_locator(ctarray),
    CborType::Integer(O_FQDN_LOCATOR) => grasp_parse_fqdn_locator(ctarray),
    CborType::Integer(O_URI_LOCATOR)  => grasp_parse_uri_locator(ctarray),
    _ => return Err(ConnectError::MisformedGraspObjective)
}

It looks as if your code received a GRASP message including an empty option where a locator option was expected. That is legal, for the case where the flood sender doesn't desire to provide a locator:

   message /= flood-message
   flood-message = [M_FLOOD, session-id, initiator, ttl,
                   +[objective, (locator-option / [])]]

For the ACP or BRSKI objectives, you would never send an empty option, but at least one of my demo apps does flood an objective without a locator.

I see that my code for incoming floods has an explicit test for this case..

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