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

App crash #258

Closed
hardliner66 opened this issue May 27, 2021 · 5 comments · Fixed by #262
Closed

App crash #258

hardliner66 opened this issue May 27, 2021 · 5 comments · Fixed by #262
Labels
C-bug Category: bug

Comments

@hardliner66
Copy link

hardliner66 commented May 27, 2021

I just tried to run the tool on all our sources and it crashed. Here is the crash report:
report.tar.gz

This is the file that makes it crash:
bad_file.tar.gz

@epage epage added the C-bug Category: bug label May 27, 2021
@epage
Copy link
Collaborator

epage commented May 27, 2021

Thanks for reporting this!

I had thought I had gotten all of the unicode handling correct but apparently I am missing something. I'll dig into this.

@epage
Copy link
Collaborator

epage commented May 27, 2021

.get(slice).unwrap() should just be &line[slice] to get a good message

thread 'main' panicked at 'byte index 28 is not a char boundary; it is inside '�' (bytes 26..29) of `SetupFileMissing=In�tala�n� adres�r neobsahuje s�bor %1. Opravte, pros�m, t�to chybu alebo si zaobstarajte nov� k�piu tohto produktu.`', src/bin/typos-cli/report.rs:194:63

Need to dig into the unicode meaning for this. It looks like \xFD a is one character and we are trying to slice right before the a. If I can confirm this, it means something isn't right in our parser, it isn't correctly identifying unicode boundaries when identifying words.

epage pushed a commit to epage/typos that referenced this issue May 28, 2021
When rendering typos, we look up what visual column the typoe starts on
but I mixed a raw byte offset with the offset into a lossy string.  This
caused panics when dealing with non-ascii content.

Fixes crate-ci#258
@epage
Copy link
Collaborator

epage commented May 28, 2021

Found the problem and got a fix running through CI now!

Thanks again for trying typos and for reporting this issue!

epage pushed a commit to epage/typos that referenced this issue May 28, 2021
When rendering typos, we look up what visual column the typoe starts on
but I mixed a raw byte offset with the offset into a lossy string.  This
caused panics when dealing with non-ascii content.

Fixes crate-ci#258
@epage
Copy link
Collaborator

epage commented May 28, 2021

v1.0.2 is now released with the fix for this. Given time, pre-built binaries will get uploaded.

I'm also writing up a guide that explains how to exempt words and files.

@hardliner66
Copy link
Author

Nice. I just ran the tool again and it didn't crash. Thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants