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

bug: stripTags - regex recursive loop #255

Open
gem85247 opened this issue Jun 12, 2023 · 1 comment
Open

bug: stripTags - regex recursive loop #255

gem85247 opened this issue Jun 12, 2023 · 1 comment

Comments

@gem85247
Copy link

I'm submitting a ... (check one with "x")

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
  • Ngx-pipes version: 3.2.2

Current behavior

When passing the following through the "stripTags" pipe the browser crashes because of a regex recursive loop. Here is the breaking input:

• Damas Syrian (100 metres) < 1-minute walk
• Brazza cocktailbar (160 metres) < 2-minute walk
• Spanish Inn - Live Music Pub (400 metres) < 5-minute walk
• Bistro Mathilda (450 metres) < 5-minute walk

Expected behavior

Should return requested output without bricking the browser.

Minimal reproduction of the problem with instructions

STEPS TO REPRODUCE

Pass the breaking inpu (see above) and watch the browser/javascript engine crash/freeze.

MINIMAL DEMO

Just grabbed the regex from the source code and you can test the following snippet in any browser console:

console.log(`• Damas Syrian (100 metres) < 1-minute walk
• Brazza cocktailbar (160 metres) < 2-minute walk
• Spanish Inn - Live Music Pub (400 metres) < 5-minute walk
• Bistro Mathilda (450 metres) < 5-minute walk`.replace(/<(?:.|\s)*?>/g, ''));

Please tell us about your environment:

MacOs, WebStorm IDE, npm

  • Angular version: 15.2.9
  • Node (for AoT issues): node --version =
@gem85247
Copy link
Author

The following Regex seems to fix the issue: /(<([^>]+)>)/gi. But I'm not a regex expert by any means 🙃

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