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

Infinite loop with specific ANSI string #101

Open
Sembiance opened this issue Apr 10, 2022 · 2 comments
Open

Infinite loop with specific ANSI string #101

Sembiance opened this issue Apr 10, 2022 · 2 comments

Comments

@Sembiance
Copy link

The following code will produce an infinite loop that ansi-to-html never returns from:

var Convert = require('ansi-to-html');
var convert = new Convert();
console.log(convert.toHtml('\u001b[15;1!\u001b[17;2!\u001b[11;0;3549;3080;3840;241;943;4082;3086;124;221;175;124;15;1807;3086;221!'));
@Sembiance
Copy link
Author

Narrowed it down to this text.replace op: "\u001b[11;0;3549;3080;3840;241;943;4082;3086;124;221;175;124;15;1807;3086;221!".replace(/^\x1b\[((?:\d{1,3};?)+|)m/, v => "hi")

@Sembiance
Copy link
Author

For anyone else experiencing this, you can se the following v8 flag to fix the problem: --enable-experimental-regexp-engine-on-excessive-backtracks

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

No branches or pull requests

1 participant