Skip to content
This repository was archived by the owner on Sep 7, 2024. It is now read-only.
This repository was archived by the owner on Sep 7, 2024. It is now read-only.

Truncate Regex Causes Infinite Loop #24

@jbasdf

Description

@jbasdf

This commit adds no value attributes to the truncation process but also introduces an infinite loop. Running this regex: KEY_VALUE_REGEX = '([\w|-]+\s*(=\s*"[^"]")?\s)*' on an iframe with attributes with and without values will result in the process freezing. For example, this bit of code will result in the process locking:
<iframe width="560" height="315" src="//www.youtube.com/embed/eFGolAT2l6c" frameborder="0" allowfullscreen></iframe>

The specific line that freezes is 205:
selfClose = SELF_CLOSE_REGEX.exec(result);

This error can be reproduced by executing that line of code, having set the pertinent values, on the command line. I've also written a test to demonstrate the problem on this branch:

master...jbasdf:locking_bug

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