summaryrefslogtreecommitdiffstats
path: root/meta-python/recipes-devtools/python/python3-django/CVE-2024-24680.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-python/recipes-devtools/python/python3-django/CVE-2024-24680.patch')
-rw-r--r--meta-python/recipes-devtools/python/python3-django/CVE-2024-24680.patch48
1 files changed, 48 insertions, 0 deletions
diff --git a/meta-python/recipes-devtools/python/python3-django/CVE-2024-24680.patch b/meta-python/recipes-devtools/python/python3-django/CVE-2024-24680.patch
new file mode 100644
index 0000000000..aec67453ae
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-django/CVE-2024-24680.patch
@@ -0,0 +1,48 @@
1From 572ea07e84b38ea8de0551f4b4eda685d91d09d2
2From: Adam Johnson <me@adamj.eu>
3Date: Mon Jan 22 13:21:13 2024 +0000
4Subject: [PATCH] Fixed CVE-2024-24680 -- Mitigated potential DoS in intcomma
5 template filter
6
7Thanks Seokchan Yoon for the report.
8
9Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
10Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
11Co-authored-by: Shai Berger <shai@platonix.com>
12
13CVE: CVE-2024-24680
14
15Upstream-Status: Backport [https://github.com/django/django/commit/572ea07e84b38ea8de0551f4b4eda685d91d09d2]
16
17Signed-off-by: Rahul Janani Pandi <RahulJanani.Pandi@windriver.com>
18---
19 django/contrib/humanize/templatetags/humanize.py | 13 +++++++------
20 1 file changed, 7 insertions(+), 6 deletions(-)
21
22diff --git a/django/contrib/humanize/templatetags/humanize.py b/django/contrib/humanize/templatetags/humanize.py
23index 194c7e8..ee22a45 100644
24--- a/django/contrib/humanize/templatetags/humanize.py
25+++ b/django/contrib/humanize/templatetags/humanize.py
26@@ -71,13 +71,14 @@ def intcomma(value, use_l10n=True):
27 return intcomma(value, False)
28 else:
29 return number_format(value, force_grouping=True)
30- orig = str(value)
31- new = re.sub(r"^(-?\d+)(\d{3})", r'\g<1>,\g<2>', orig)
32- if orig == new:
33- return new
34- else:
35- return intcomma(new, use_l10n)
36
37+ result = str(value)
38+ match = re.match(r"-?\d+", result)
39+ if match:
40+ prefix = match[0]
41+ prefix_with_commas = re.sub(r"\d{3}", r"\g<0>,", prefix[::-1])[::-1]
42+ result = prefix_with_commas + result[len(prefix) :]
43+ return result
44
45 # A tuple of standard large number to their converters
46 intword_converters = (
47--
482.40.0