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 in do_parse with take #481

Closed
chifflier opened this issue Mar 26, 2017 · 0 comments · Fixed by #486
Closed

Panic in do_parse with take #481

chifflier opened this issue Mar 26, 2017 · 0 comments · Fixed by #486

Comments

@chifflier
Copy link
Contributor

Hi,

The following parser:

named!(parser02<&[u8],()>,
    do_parse!(
        hdr: take!(1) >>
        data: take!(18446744073709551615) >>
        ( () )
    )
);

#[test]
fn test02() {
    let data = b"0\x88\xff\xff\xff\xff\xff\xff\xff\xff00\x0f\x02\x000\x00\x00\x00\x00\x00\x0000\x0f\x00\xff\x0a\xbb\xff";
    let _ = parser02(data);
}

fails with an error:

thread 'test02' panicked at 'attempt to add with overflow', <do_parse macros>:33

The backtrace is not interesting, so not reported here.

The bug was originally discovered in rusticata/x509-parser#1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant