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

Integer overflow in nested comment parser when nesting depth exceeds 4 billion #357

Closed
dtolnay opened this issue Oct 15, 2022 · 0 comments · Fixed by #358
Closed

Integer overflow in nested comment parser when nesting depth exceeds 4 billion #357

dtolnay opened this issue Oct 15, 2022 · 0 comments · Fixed by #358

Comments

@dtolnay
Copy link
Owner

dtolnay commented Oct 15, 2022

fn main() {
    let mut input = "/*".repeat(u32::MAX as usize + 3);
    input.truncate(input.len() - 2);
    input.push_str("*/");
    println!("{}", input.parse::<proc_macro2::TokenStream>().is_ok());
}

This program should print false but it prints true.

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

Successfully merging a pull request may close this issue.

1 participant