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

Don't attempt to process ANSI sequences in non-UTF8 input #1117

Merged
merged 1 commit into from
Jul 2, 2022

Conversation

dandavison
Copy link
Owner

@dandavison dandavison commented Jul 2, 2022

Fixes #677

from_utf8_lossy was being used to convert non-utf8 (e.g. binary) input to utf-8, and we were attempting to process the result as if it were a valid utf-8 string containing ANSI escape sequences. However, from_utf8_lossy can produce output that causes the ANSI parser to panic. An example is \u{fffd}J␊ i.e. ef bf bd 4a 0a.

@dandavison dandavison merged commit ab8015e into master Jul 2, 2022
@dandavison dandavison deleted the 677-fix-crashes-on-binary-input branch July 2, 2022 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

panic for certain unicode code points when rendering patch 🐛
1 participant