From b20416fb976a24b8cd939261a1237e314298e457 Mon Sep 17 00:00:00 2001 From: lipengyu Date: Wed, 6 Aug 2025 08:15:25 +0800 Subject: [PATCH] fix CVE-2025-1975 --- backport-CVE-2025-1795.patch | 60 ++++++++++++++++++++++++++++++++++++ python3.spec | 10 +++++- 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 backport-CVE-2025-1795.patch diff --git a/backport-CVE-2025-1795.patch b/backport-CVE-2025-1795.patch new file mode 100644 index 0000000..ed846af --- /dev/null +++ b/backport-CVE-2025-1795.patch @@ -0,0 +1,60 @@ +From 70754d21c288535e86070ca7a6e90dcb670b8593 Mon Sep 17 00:00:00 2001 +From: "Miss Islington (bot)" + <31488909+miss-islington@users.noreply.github.com> +Date: Sat, 17 Feb 2024 14:01:02 +0100 +Subject: [PATCH] [3.11] gh-100884: email/_header_value_parser: don't encode + list separators (GH-100885) (GH-115593) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +ListSeparator should not be encoded. This could happen when a long line +pushes its separator to the next line, which would have been encoded. +(cherry picked from commit 09fab93c3d857496c0bd162797fab816c311ee48) + +Co-authored-by: Thomas Weißschuh +--- + Lib/email/_header_value_parser.py | 3 ++- + Lib/test/test_email/test__header_value_parser.py | 5 +++++ + 2 files changed, 7 insertions(+), 1 deletion(-) + +diff --git a/Lib/email/_header_value_parser.py b/Lib/email/_header_value_parser.py +index f833523..f820ce1 100644 +--- a/Lib/email/_header_value_parser.py ++++ b/Lib/email/_header_value_parser.py +@@ -944,6 +944,7 @@ class _InvalidEwError(errors.HeaderParseError): + # up other parse trees. Maybe should have tests for that, too. + DOT = ValueTerminal('.', 'dot') + ListSeparator = ValueTerminal(',', 'list-separator') ++ListSeparator.as_ew_allowed = False + RouteComponentMarker = ValueTerminal('@', 'route-component-marker') + + # +@@ -2017,7 +2018,7 @@ def get_address_list(value): + address_list.defects.append(errors.InvalidHeaderDefect( + "invalid address in address-list")) + if value: # Must be a , at this point. +- address_list.append(ValueTerminal(',', 'list-separator')) ++ address_list.append(ListSeparator) + value = value[1:] + return address_list, value + +diff --git a/Lib/test/test_email/test__header_value_parser.py b/Lib/test/test_email/test__header_value_parser.py +index 4894d8f..080ee5a 100644 +--- a/Lib/test/test_email/test__header_value_parser.py ++++ b/Lib/test/test_email/test__header_value_parser.py +@@ -2828,6 +2828,11 @@ class TestFolding(TestEmailBase): + '=?utf-8?q?H=C3=BCbsch?= Kaktus ,\n' + ' =?utf-8?q?bei=C3=9Ft_bei=C3=9Ft?= \n') + ++ def test_address_list_with_list_separator_after_fold(self): ++ to = '0123456789' * 8 + '@foo, ä ' ++ self._test(parser.get_address_list(to)[0], ++ '0123456789' * 8 + '@foo,\n =?utf-8?q?=C3=A4?= \n') ++ + # XXX Need tests with comments on various sides of a unicode token, + # and with unicode tokens in the comments. Spaces inside the quotes + # currently don't do the right thing. +-- +2.33.0 + diff --git a/python3.spec b/python3.spec index 528da28..dc082e5 100644 --- a/python3.spec +++ b/python3.spec @@ -3,7 +3,7 @@ Summary: Interpreter of the Python3 programming language URL: https://www.python.org/ Version: 3.7.9 -Release: 43 +Release: 44 License: Python-2.0 %global branchversion 3.7 @@ -174,6 +174,7 @@ Patch6062: backport-CVE-2022-48566.patch Patch6063: backport-0001-CVE-2023-40217.patch Patch6064: backport-0002-CVE-2023-40217.patch Patch6065: backport-0003-CVE-2023-40217.patch +Patch6066: backport-CVE-2025-1795.patch patch9000: Don-t-override-PYTHONPATH-which-is-already-set.patch patch9001: add-the-sm3-method-for-obtaining-the-salt-value.patch @@ -350,6 +351,7 @@ rm Lib/ensurepip/_bundled/*.whl %patch6063 -p1 %patch6064 -p1 %patch6065 -p1 +%patch6066 -p1 %patch9000 -p1 %patch9001 -p1 @@ -972,6 +974,12 @@ export BEP_GTDLIST="$BEP_GTDLIST_TMP" %{_mandir}/*/* %changelog +* Mon Sep 01 2025 lipengyu - 3.7.9-44 +- Type:CVE +- CVE:CVE-2025-1795 +- SUG:NA +- DESC:fix CVE-2025-1795 + * Thu Dec 19 2024 wangshuo - 3.7.9-43 - Type:CVE - CVE:CVE-2024-9287 -- Gitee