diff options
Diffstat (limited to 'meta/recipes-devtools/python/python3-pygments/CVE-2022-40896-0001.patch')
| -rw-r--r-- | meta/recipes-devtools/python/python3-pygments/CVE-2022-40896-0001.patch | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python3-pygments/CVE-2022-40896-0001.patch b/meta/recipes-devtools/python/python3-pygments/CVE-2022-40896-0001.patch new file mode 100644 index 0000000000..d7fc87fec8 --- /dev/null +++ b/meta/recipes-devtools/python/python3-pygments/CVE-2022-40896-0001.patch | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | From 9a73f2a80e5cf869d473ddcbfceaab229fb99b5e Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Narpat Mali <narpat.mali@windriver.com> | ||
| 3 | Date: Mon, 28 Aug 2023 15:04:14 +0000 | ||
| 4 | Subject: [PATCH] SQL+Jinja: use a simpler regex in analyse_text | ||
| 5 | |||
| 6 | Fixes catastrophic backtracking | ||
| 7 | |||
| 8 | Fixes #2355 | ||
| 9 | |||
| 10 | CVE: CVE-2022-40896 | ||
| 11 | |||
| 12 | Upstream-Status: Backport [https://github.com/pygments/pygments/commit/97eb3d5ec7c1b3ea4fcf9dee30a2309cf92bd194] | ||
| 13 | |||
| 14 | Signed-off-by: Narpat Mali <narpat.mali@windriver.com> | ||
| 15 | --- | ||
| 16 | CHANGES | 1 + | ||
| 17 | pygments/lexers/templates.py | 6 +----- | ||
| 18 | 2 files changed, 2 insertions(+), 5 deletions(-) | ||
| 19 | |||
| 20 | diff --git a/CHANGES b/CHANGES | ||
| 21 | index 2aa54fa..4c84fa6 100644 | ||
| 22 | --- a/CHANGES | ||
| 23 | +++ b/CHANGES | ||
| 24 | @@ -61,6 +61,7 @@ Version 2.14.0 | ||
| 25 | * Spice: Add ``enum`` keyword and fix a bug regarding binary, | ||
| 26 | hexadecimal and octal number tokens (#2227) | ||
| 27 | * YAML: Accept colons in key names (#2277) | ||
| 28 | + * SQL+Jinja (``analyse_text`` method): fix catastrophic backtracking [Backported] | ||
| 29 | |||
| 30 | - Fix `make mapfiles` when Pygments is not installed in editable mode | ||
| 31 | (#2223) | ||
| 32 | diff --git a/pygments/lexers/templates.py b/pygments/lexers/templates.py | ||
| 33 | index 1fcf708..1066294 100644 | ||
| 34 | --- a/pygments/lexers/templates.py | ||
| 35 | +++ b/pygments/lexers/templates.py | ||
| 36 | @@ -2291,10 +2291,6 @@ class SqlJinjaLexer(DelegatingLexer): | ||
| 37 | if re.search(r'\{\{\s*source\(.*\)\s*\}\}', text): | ||
| 38 | rv += 0.25 | ||
| 39 | # Jinja macro | ||
| 40 | - if re.search( | ||
| 41 | - r'\{%-?\s*macro \w+\(.*\)\s*-?%\}\s+.*\s+\{%-?\s*endmacro\s*-?%\}', | ||
| 42 | - text, | ||
| 43 | - re.S, | ||
| 44 | - ): | ||
| 45 | + if re.search(r'\{%-?\s*macro \w+\(.*\)\s*-?%\}', text): | ||
| 46 | rv += 0.15 | ||
| 47 | return rv | ||
| 48 | -- | ||
| 49 | 2.40.0 | ||
