Skip to content

ReDoS: fix canonicalization in NfaUtils#11071

Merged
erik-krogh merged 3 commits into
github:mainfrom
erik-krogh:fixCanon
Nov 7, 2022
Merged

ReDoS: fix canonicalization in NfaUtils#11071
erik-krogh merged 3 commits into
github:mainfrom
erik-krogh:fixCanon

Conversation

@erik-krogh
Copy link
Copy Markdown
Contributor

@erik-krogh erik-krogh commented Nov 1, 2022

The cc = getCanonicalCharClass(term) predicate got a char-class for the canonical representative term, so it was not meant to be used unless you already had the canonical representative.

That wasn't how it was used in js/incomplete-multi-character-sanitization, which caused a FN when I converted the regex code to a shared pack.
(Some sorting got slightly changed, which changed the canonicalization a tiny bit).

Evaluation looks good: Python, Ruby, Java, JavaScript.
Performance is neutral, and there are a few more results that were erroneously missing due to the bad canonicalization.

@erik-krogh erik-krogh requested review from a team as code owners November 1, 2022 20:38
@erik-krogh erik-krogh mentioned this pull request Nov 1, 2022
2 tasks
@erik-krogh erik-krogh added the no-change-note-required This PR does not need a change note label Nov 1, 2022
@calumgrant calumgrant requested a review from asgerf November 7, 2022 09:30
@erik-krogh erik-krogh merged commit d67235b into github:main Nov 7, 2022
erik-krogh added a commit to erik-krogh/ql that referenced this pull request Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants