You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I got a panic when parsing a Java file, here's a minimal reproduction case:
$ echo'// TODO "%>"'> Minimal.java
$ RUST_BACKTRACE=1 cargo run --example synstats Minimal.java
Stack trace:
thread 'main' panicked at 'attempt to subtract with overflow', src/parsing/parser.rs:147:41
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
1: std::panicking::default_hook::{{closure}}
at src/libstd/sys_common/backtrace.rs:68
at src/libstd/sys_common/backtrace.rs:57
at src/libstd/panicking.rs:381
2: std::panicking::default_hook
at src/libstd/panicking.rs:397
3: std::panicking::begin_panic
at src/libstd/panicking.rs:577
4: std::panicking::begin_panic
at src/libstd/panicking.rs:538
5: std::panicking::try::do_call
at src/libstd/panicking.rs:522
6: std::panicking::try::do_call
at src/libstd/panicking.rs:498
7: <core::ops::range::Range<Idx> as core::fmt::Debug>::fmt
at src/libcore/panicking.rs:71
8: <core::ops::range::Range<Idx> as core::fmt::Debug>::fmt
at src/libcore/panicking.rs:51
9: syntect::parsing::parser::ParseState::parse_next_token
at src/parsing/parser.rs:147
10: <F as core::str::pattern::Pattern<'a>>::into_searcher
at src/parsing/parser.rs:122
11: synstats::count
at examples/synstats.rs:138
12: synstats::main
at examples/synstats.rs:163
13: std::rt::lang_start::{{closure}}
at /Users/travis/build/rust-lang/rust/src/libstd/rt.rs:74
14: std::panicking::try::do_call
at src/libstd/rt.rs:59
at src/libstd/panicking.rs:480
15: panic_unwind::dwarf::eh::read_encoded_pointer
at src/libpanic_unwind/lib.rs:101
16: std::sys_common::bytestring::debug_fmt_bytestring
at src/libstd/panicking.rs:459
at src/libstd/panic.rs:365
at src/libstd/rt.rs:58
17: std::rt::lang_start
at /Users/travis/build/rust-lang/rust/src/libstd/rt.rs:74
18: <synstats::Stats as core::default::Default>::default
In a release build the error looks like this:
thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 18446744073709551615'
The Java syntax has a prototype like this:
prototype:
- match: '(?=%>)'
pop: true
Because of the way we construct the special __start context (after
parsing the actual syntax definition), that prototype was in effect for
__start too.
Disabling it via `meta_include_prototype: false` fixes#139.
I got a panic when parsing a Java file, here's a minimal reproduction case:
Stack trace:
In a release build the error looks like this:
It looks like
self.stack
is empty here: https://github.com/trishume/syntect/blob/v2.0.0/src/parsing/parser.rs#L147(CC @keith-hall)
The text was updated successfully, but these errors were encountered: