-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Helix crashes when editing files with Russian text #7273
Comments
Open any Markdown file with Cyrillic characters, edit it and after some time Helix crashes. |
What edits are you making? Can you narrow down the reproduction steps? I can't reproduce with random changes |
I was able to reprsuce this. The problem is that TS asks for the byte range of a node during incremental parsing. That byte range is somehow not aligned to char boundaries which causes a panic in This will also fix some other crashes (I think there are multiple open issues caused by this). It's potentially/likely a grammar bug that some nodes are not aligned to char boundaries (but I am but sure). I think we should fix the osnic either way |
I was able to get steps to segfault the parser: just keep on pasting Not really sure it's the same issue as the stacktrace differs:
Payload in parse_with[111, 99, 115, 47, 96, 32, 208, 184, 32, 208, 178, 209, 139, 208, 191, 208, 190, 208, 187, 208, 189, 208, 184, 209, 130, 208, 181, 58, 10, 10, 96, 96, 96, 98, 97, 115, 104, 10, 109, 100, 98, 111, 111, 107, 32, 115, 101, 114, 118, 101, 32, 45, 45, 111, 112, 101, 110, 10, 96, 96, 96, 10, 10, 62, 32, 42, 42, 208, 146, 208, 189, 208, 184, 208, 188, 208, 176, 208, 189, 208, 184, 208, 181, 33, 42, 42, 10, 62, 10, 62, 32, 208, 148, 208, 187, 209, 143, 32, 209, 141, 209, 130, 208, 190, 208, 179, 208, 190, 32, 208, 178, 208, 176, 208, 188, 32, 208, 189, 208, 181, 208, 190, 208, 177, 209, 133, 208, 190, 208, 180, 208, 184, 208, 188, 32, 109, 100, 66, 111, 111, 107, 58, 10, 10, 96, 96, 96, 98, 97, 115, 104, 10, 99, 97, 114, 103, 111, 32, 105, 110, 115, 116, 97, 108, 108, 32, 109, 100, 98, 111, 111, 107, 10, 96, 96, 96, 10, 10, 35, 35, 35, 32, 208, 148, 208, 187, 209, 143, 32, 209, 128, 208, 176, 208, 183, 209, 128, 208, 176, 208, 177, 208, 190, 209, 130, 209, 135, 208, 184, 208, 186, 208, 190, 208, 178, 10, 10, 96, 96, 96, 98, 97, 115, 104, 10, 99, 97, 114, 103, 111, 32, 100, 111, 99, 32, 45, 45, 110, 111, 45, 100, 101, 112, 115, 32, 45, 45, 111, 112, 101, 110, 10, 96, 96, 96, 10]The failing function: with UPD: sometimes it panics at |
Ok, here even more detailed case that also reproduces on master and latest release:
now it should panic with stack trace
#6 0x0000556f0826041b in ropey::slice::RopeSlice::byte_slice> (self=0x7ffd64a350e8, byte_range=...)
at /home/kitsu/.cargo/registry/src/github.com-1ecc6299db9ec823/ropey-1.6.1/src/slice.rs:703
#7 0x0000556f081f0470 in helix_core::syntax::HighlightConfiguration::injection_pair (self=0x556f0929e020, query_match=0x7ffd64a35910, source=...)
at helix-core/src/syntax.rs:1824
#8 0x0000556f081f0801 in helix_core::syntax::HighlightConfiguration::injection_for_match (self=0x556f0929e020, query=0x556f0929e0c0,
query_match=0x7ffd64a35910, source=...) at helix-core/src/syntax.rs:1856
#9 0x0000556f082713a6 in helix_core::syntax::{impl#13}::update::{closure#1} (ts_parser=0x7fa78b5f8cb0) at helix-core/src/syntax.rs:1148
#10 0x0000556f081f6b54 in std::thread::local::LocalKey>::try_with, helix_core::syntax::{impl#13}::update::{closure_env#1}, core::result::Result<(), helix_core::syntax::Error>> (self=0x556f08cd52f8, f=...)
at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/thread/local.rs:445
#11 0x0000556f081f5cbd in std::thread::local::LocalKey>::with, helix_core::syntax::{impl#13}::update::{closure_env#1}, core::result::Result<(), helix_core::syntax::Error>> (self=0x556f08cd52f8, f=...)
at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/thread/local.rs:421
#12 0x0000556f081ecaa7 in helix_core::syntax::Syntax::update (self=0x556f0942cf40, old_source=..., source=..., changeset=0x7ffd64a37390)
at helix-core/src/syntax.rs:1094
#13 0x0000556f07681e94 in helix_view::document::Document::apply_impl (self=0x556f0942ceb0, transaction=0x7ffd64a37390, view_id=..., emit_lsp_notification=true)
at helix-view/src/document.rs:1203
#14 0x0000556f0768289c in helix_view::document::Document::apply_inner (self=0x556f0942ceb0, transaction=0x7ffd64a37390, view_id=..., emit_lsp_notification=true)
at helix-view/src/document.rs:1296
#15 0x0000556f07682ab1 in helix_view::document::Document::apply (self=0x556f0942ceb0, transaction=0x7ffd64a37390, view_id=...)
at helix-view/src/document.rs:1308
#16 0x0000556f06b28c89 in helix_term::commands::paste_impl (values=..., doc=0x556f0942ceb0, view=0x556f093a1c90, action=helix_term::commands::Paste::Cursor,
count=1, mode=helix_view::document::Mode::Insert) at helix-term/src/commands.rs:4076
#17 0x0000556f06b290c7 in helix_term::commands::paste_bracketed_value (cx=0x7ffd64a37828, contents=...) at helix-term/src/commands.rs:4087
Note, it won't work if just paste the whole input at once. Panics at:
|
I got the same panic message when editting, but at difference line of source. Not yet reproducable, since I've lost some unsaved text..
|
Summary
Helix crashes when I edit a Markdown document that is part or all Cyrillic characters. An error is displayed in the terminal:
LC_ALL
:en_US.UTF-8
, then setru_RU.UTF-8
Reproduction Steps
I tried this:
hx
orRUST_BACKTRACE=1 hx -vv README.md
I expected this to happen:
Instead, this happened:
Helix log
~/.cache/helix/helix.log
Platform
Linux
Terminal Emulator
GNOME Console 44.0
Helix Version
helix 23.05 (7f5940b)
The text was updated successfully, but these errors were encountered: