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

Fix panics parsing regex with whitespace in extended mode #349

Commits on Mar 20, 2017

  1. Fix panics parsing regex with whitespace in extended mode

    The added tests fail without the fix like this:
    
        ---- parser::tests::ignore_space_escape_hex2 stdout ----
        	thread 'parser::tests::ignore_space_escape_hex2' panicked at 'called `Result::unwrap()` on an `Err` value: Error { pos: 10, surround: "x 5 3", kind: InvalidBase16(" 5 3") }', src/libcore/result.rs:860
    
        ---- parser::tests::ignore_space_escape_hex stdout ----
        	thread 'parser::tests::ignore_space_escape_hex' panicked at 'called `Result::unwrap()` on an `Err` value: Error { pos: 12, surround: "{ 5 3 }", kind: InvalidBase16(" 5 3") }', src/libcore/result.rs:860
    
        ---- parser::tests::ignore_space_ascii_classes stdout ----
        	thread 'parser::tests::ignore_space_ascii_classes' panicked at 'called `Result::unwrap()` on an `Err` value: Error { pos: 5, surround: "(?x)[ [ : ", kind: UnsupportedClassChar('[') }', src/libcore/result.rs:860
        note: Run with `RUST_BACKTRACE=1` for a backtrace.
    
        ---- parser::tests::ignore_space_escape_octal stdout ----
        	thread 'parser::tests::ignore_space_escape_octal' panicked at 'valid octal number', src/libcore/option.rs:785
    
        ---- parser::tests::ignore_space_escape_unicode_name stdout ----
        	thread 'parser::tests::ignore_space_escape_unicode_name' panicked at 'called `Result::unwrap()` on an `Err` value: Error { pos: 15, surround: "Y i }", kind: UnrecognizedUnicodeClass(" Y i") }', src/libcore/result.rs:860
    
        ---- parser::tests::ignore_space_repeat_counted stdout ----
        	thread 'parser::tests::ignore_space_repeat_counted' panicked at 'called `Result::unwrap()` on an `Err` value: Error { pos: 15, surround: ", 1 0 }", kind: InvalidBase10("1 0") }', src/libcore/result.rs:860
    
    The reason for the panics is that `bump_get` would ignore space when
    walking the characters, but then keep the spaces in the returned String.
    
    Found using cargo-fuzz.
    robinst committed Mar 20, 2017
    Configuration menu
    Copy the full SHA
    bbf4e15 View commit details
    Browse the repository at this point in the history