Skip to content

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

Merged
dandavison merged 1 commit intomasterfrom
677-fix-crashes-on-binary-input
Jul 2, 2022
Merged

Don't attempt to process ANSI sequences in non-UTF8 input#1117
dandavison merged 1 commit intomasterfrom
677-fix-crashes-on-binary-input

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