Skip to content

Commit

Permalink
Merge pull request #1973 from kevinbackhouse/GHSL-2021-113-fix-ReDoS-…
Browse files Browse the repository at this point in the history
…second-attempt

GHSL-2021-113: Fix ReDoS bug (second attempt)
  • Loading branch information
bitwiseman committed Dec 9, 2021
2 parents 37098ba + 19c5862 commit 6a919cc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion js/src/javascript/tokenizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ var Tokenizer = function(input_string, options) {
html_comment_end: pattern_reader.matching(/-->/),
include: pattern_reader.starting_with(/#include/).until_after(acorn.lineBreak),
shebang: pattern_reader.starting_with(/#!/).until_after(acorn.lineBreak),
xml: pattern_reader.matching(/[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[\s\S]+?}|!\[CDATA\[[\s\S]*?\]\]|)(\s+{[\s\S]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{[\s\S]+?}))*\s*(\/?)\s*>/),
xml: pattern_reader.matching(/[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[^}]+?}|!\[CDATA\[[^\]]*?\]\]|)(\s*{[^}]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{([^{}]|{[^}]+?})+?}))*\s*(\/?)\s*>/),
single_quote: templatable.until(/['\\\n\r\u2028\u2029]/),
double_quote: templatable.until(/["\\\n\r\u2028\u2029]/),
template_text: templatable.until(/[`\\$]/),
Expand Down
2 changes: 1 addition & 1 deletion python/jsbeautifier/javascript/tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def __init__(self):
directives_core = Directives(r"/\*", r"\*/")

xmlRegExp = re.compile(
r'[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[\s\S]+?}|!\[CDATA\[[\s\S]*?\]\]|)(\s+{[\s\S]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*(\'[^\']*\'|"[^"]*"|{[\s\S]+?}))*\s*(/?)\s*>'
r'[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[^}]+?}|!\[CDATA\[[^\]]*?\]\]|)(\s*{[^}]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*(\'[^\']*\'|"[^"]*"|{([^{}]|{[^}]+?})+?}))*\s*(\/?)\s*>'
)


Expand Down

0 comments on commit 6a919cc

Please sign in to comment.