diff --git a/CHANGELOG.txt b/CHANGELOG.txt index dd8f8fd..95b7b5b 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,6 +1,7 @@ === UNRELEASED * Fixed `$` in `patternProperties` matching before a trailing newline, which also made a `pattern` with the same regex accept a trailing newline +* Fixed quadratic backtracking in the `email` and `idn-email` format regexes on long invalid strings === 2.22.3 (2026-11-01) diff --git a/fastjsonschema/draft04.py b/fastjsonschema/draft04.py index cba1e48..aa4e1f3 100644 --- a/fastjsonschema/draft04.py +++ b/fastjsonschema/draft04.py @@ -34,7 +34,7 @@ class CodeGeneratorDraft04(CodeGenerator): # library. Some regexps are not 100% precise but good enough, fast and without dependencies. FORMAT_REGEXS = { 'date-time': r'^(?:' + DATE_REGEX + r')(t|T)(?:[01]\d|2[0-3]):[0-5]\d:(?:[0-5]\d|60)(?:\.\d+)?(?:[+-](?:[01]\d|2[0-3]):[0-5]\d|[+-](?:[01]\d|2[0-3])[0-5]\d|z|Z)\Z', - 'email': r'^(?!.*\.\..*@)[^@.][^@]*(?