Skip to content

bug: stripTags - regex recursive loop #255

Description

@gem85247

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 =

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions