diff --git a/baakport-Restore-IDNAError-exception-for-codepoints-that-don-.patch b/baakport-Restore-IDNAError-exception-for-codepoints-that-don-.patch new file mode 100644 index 0000000000000000000000000000000000000000..512f395768a0449b6d6196166656e1d836eee9f3 --- /dev/null +++ b/baakport-Restore-IDNAError-exception-for-codepoints-that-don-.patch @@ -0,0 +1,45 @@ +From b0d8f3c45d83b8b9bce0975a59f0c8ab6645694c Mon Sep 17 00:00:00 2001 +From: Kim Davies +Date: Wed, 24 Apr 2024 11:22:42 -0400 +Subject: [PATCH] Restore IDNAError exception for codepoints that don't exist + in Unicode + +--- + idna/core.py | 8 ++++++-- + tests/test_idna.py | 1 + + 2 files changed, 7 insertions(+), 2 deletions(-) + +diff --git a/idna/core.py b/idna/core.py +index 0dae61a..69b66ef 100644 +--- a/idna/core.py ++++ b/idna/core.py +@@ -240,8 +240,12 @@ def check_label(label: Union[str, bytes, bytearray]) -> None: + if intranges_contain(cp_value, idnadata.codepoint_classes['PVALID']): + continue + elif intranges_contain(cp_value, idnadata.codepoint_classes['CONTEXTJ']): +- if not valid_contextj(label, pos): +- raise InvalidCodepointContext('Joiner {} not allowed at position {} in {}'.format( ++ try: ++ if not valid_contextj(label, pos): ++ raise InvalidCodepointContext('Joiner {} not allowed at position {} in {}'.format( ++ _unot(cp_value), pos+1, repr(label))) ++ except ValueError: ++ raise IDNAError('Unknown codepoint adjacent to joiner {} at position {} in {}'.format( + _unot(cp_value), pos+1, repr(label))) + elif intranges_contain(cp_value, idnadata.codepoint_classes['CONTEXTO']): + if not valid_contexto(label, pos): +diff --git a/tests/test_idna.py b/tests/test_idna.py +index 81afb32..0641eeb 100755 +--- a/tests/test_idna.py ++++ b/tests/test_idna.py +@@ -270,6 +270,7 @@ class IDNATests(unittest.TestCase): + self.assertRaises(idna.IDNAError, decode, b'xn--') + self.assertRaises(idna.IDNAError, decode, b'\x8d\xd2') + self.assertRaises(idna.IDNAError, decode, b'A.A.0.a.a.A.0.a.A.A.0.a.A.0A.2.a.A.A.0.a.A.0.A.a.A0.a.a.A.0.a.fB.A.A.a.A.A.B.A.A.a.A.A.B.A.A.a.A.A.0.a.A.a.a.A.A.0.a.A.0.A.a.A0.a.a.A.0.a.fB.A.A.a.A.A.B.0A.A.a.A.A.B.A.A.a.A.A.a.A.A.B.A.A.a.A.0.a.B.A.A.a.A.B.A.a.A.A.5.a.A.0.a.Ba.A.B.A.A.a.A.0.a.Xn--B.A.A.A.a') ++ self.assertRaises(idna.IDNAError, decode, b'xn--ukba655qaaaa14431eeaaba.c') + + if __name__ == '__main__': + unittest.main() +-- +2.9.3.windows.1 + diff --git a/backport-Restore-tools-and-HISTORY.rst-to-sdist-fixes-166.patch b/backport-Restore-tools-and-HISTORY.rst-to-sdist-fixes-166.patch new file mode 100644 index 0000000000000000000000000000000000000000..fb9e2ae8ea9ed548734bffe64682de5a9d7b06db --- /dev/null +++ b/backport-Restore-tools-and-HISTORY.rst-to-sdist-fixes-166.patch @@ -0,0 +1,22 @@ +From e96ba044f67ebad7eece627beb145f6adcf53993 Mon Sep 17 00:00:00 2001 +From: Kim Davies +Date: Mon, 27 Nov 2023 17:56:42 -0800 +Subject: [PATCH] Restore tools/ and HISTORY.rst to sdist (fixes #166) + +--- + pyproject.toml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/pyproject.toml b/pyproject.toml +index c38756a..53d89af 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -43,4 +43,4 @@ dynamic = ["version"] + + [tool.flit.sdist] + exclude = [".gitignore", ".github/"] +-include = ["tests"] ++include = ["tests", "tools", "HISTORY.rst"] +-- +2.9.3.windows.1 + diff --git a/python-idna.spec b/python-idna.spec index c8e52ac41a0d03a7a244e917388bf7a25e0ec0cf..baf0c85e400ab4615d24f583106d354173a4d123 100644 --- a/python-idna.spec +++ b/python-idna.spec @@ -1,7 +1,7 @@ %global _empty_manifest_terminate_build 0 Name: python-idna Version: 3.6 -Release: 3 +Release: 4 Summary: Internationalized Domain Names in Applications (IDNA) License: BSD URL: https://github.com/kjd/idna @@ -9,6 +9,8 @@ Source0: https://github.com/kjd/idna/archive/refs/tags/idna-3.6.tar.gz BuildArch: noarch Patch6000: backport-CVE-2024-3651.patch +Patch7000: backport-Restore-tools-and-HISTORY.rst-to-sdist-fixes-166.patch +Patch8000: baakport-Restore-IDNAError-exception-for-codepoints-that-don-.patch %description A library to support the Internationalised Domain Names in @@ -89,6 +91,11 @@ mv %{buildroot}/doclist.lst . %{_docdir}/* %changelog +* Wed May 22 2024 wuzhaomin - 3.6-4 +- Bakport commits from upstream +- Restore tools/ and HISTORY.rst to sdist (fixes #166) +- Restore IDNAError exception for codepoints that don't exist in Unicode + * Sat Apr 20 2024 zhangpan - 3.6-3 - fix CVE-2024-3651