Skip to content
New issue

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

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

Already on GitHub? # to your account

Segfault in a user binary with broken regexes #269

Open
bluecube opened this issue Nov 4, 2022 · 0 comments
Open

Segfault in a user binary with broken regexes #269

bluecube opened this issue Nov 4, 2022 · 0 comments

Comments

@bluecube
Copy link

bluecube commented Nov 4, 2022

Hi, I accidentally messed up one of my regexes and the binary that uses Logos started crashing. In debug it fails with stack overflow, in debug with GDB with a segmentation fault and in release it just hangs.

The expected behavior is a nice compile time error message.

This is the (sort of) minimal example:


#[derive(Logos, Debug)]
pub enum Token {
    #[regex(r#""(?:|\\[^\n])*""#)]
    String,
    #[error]
    Error,
}

fn main() {
    let lexer = Token::lexer("\"fubar\"");
    for (tok, span) in lexer.spanned() {
        println!("{:?} ({:?})", tok, span);
    }
}

rustc 1.64.0, logos 0.12.1.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant