Merged
fix CVE-2025-64512 #28
LiuhuioooAdd on Jun 30
fix CVE-2025-64512 #28
Merged
Total: 2 files changed+39-2
| @@ -0,0 +1,33 @@ | |||
| 1 | +From b808ee05dd7f0c8ea8ec34bdf394d40e63501086 Mon Sep 17 00:00:00 2001 | ||
| 2 | +From: Scott Tolley <michaeltolley21@hotmail.com> | ||
| 3 | +Date: Fri, 7 Nov 2025 20:47:46 +0100 | ||
| 4 | +Subject: [PATCH] Fix: arbitary code execution when loading pickle font files | ||
| 5 | + | ||
| 6 | +Fixes https://github.com/pdfminer/pdfminer.six/security/advisories/GHSA-wf5f-4jwr-ppcp | ||
| 7 | + | ||
| 8 | +Fixes https://github.com/pdfminer/pdfminer.six/security/advisories/GHSA-f83h-ghpp-7wcc | ||
| 9 | +--- | ||
| 10 | + pdfminer/cmapdb.py | 10 ++++++++-- | ||
| 11 | + 1 file changed, 8 insertions(+), 2 deletions(-) | ||
| 12 | + | ||
| 13 | +diff --git a/pdfminer/cmapdb.py b/pdfminer/cmapdb.py | ||
| 14 | +index 87d9870e..b3c7f2b0 100644 | ||
| 15 | +--- a/pdfminer/cmapdb.py | ||
| 16 | ++++ b/pdfminer/cmapdb.py | ||
| 17 | +@@ -240,8 +240,14 @@ def _load_data(cls, name: str) -> Any: | ||
| 18 | + ) | ||
| 19 | + for directory in cmap_paths: | ||
| 20 | + path = os.path.join(directory, filename) | ||
| 21 | +- if os.path.exists(path): | ||
| 22 | +- gzfile = gzip.open(path) | ||
| 23 | ++ # Resolve paths to prevent directory traversal | ||
| 24 | ++ resolved_path = os.path.realpath(path) | ||
| 25 | ++ resolved_directory = os.path.realpath(directory) | ||
| 26 | ++ # Check if resolved path is within the intended directory | ||
| 27 | ++ if not resolved_path.startswith(resolved_directory + os.sep): | ||
| 28 | ++ continue | ||
| 29 | ++ if os.path.exists(resolved_path): | ||
| 30 | ++ gzfile = gzip.open(resolved_path) | ||
| 31 | + try: | ||
| 32 | + return type(str(name), (), pickle.loads(gzfile.read())) | ||
| 33 | + finally: | ||
| @@ -1,11 +1,12 @@ | |||
| 1 | %global _empty_manifest_terminate_build 0 | 1 | %global _empty_manifest_terminate_build 0 |
| 2 | Name: python-pdfminer.six | 2 | Name: python-pdfminer.six |
| 3 | Version: 20231228 | 3 | Version: 20231228 |
| 4 | -Release: 2 | 4 | +Release: 3 |
| 5 | Summary: PDF parser and analyzer. | 5 | Summary: PDF parser and analyzer. |
| 6 | License: MIT | 6 | License: MIT |
| 7 | URL: https://github.com/pdfminer/pdfminer.six | 7 | URL: https://github.com/pdfminer/pdfminer.six |
| 8 | Source0: https://files.pythonhosted.org/packages/31/b1/a43e3bd872ded4deea4f8efc7aff1703fca8c5455d0c06e20506a06a44ff/pdfminer.six-20231228.tar.gz | 8 | Source0: https://files.pythonhosted.org/packages/31/b1/a43e3bd872ded4deea4f8efc7aff1703fca8c5455d0c06e20506a06a44ff/pdfminer.six-20231228.tar.gz |
| 9 | +Patch0: backport-CVE-2025-64512.patch | ||
| 9 | BuildArch: noarch | 10 | BuildArch: noarch |
| 10 | %description | 11 | %description |
| 11 | PDF parser and analyzer. | 12 | PDF parser and analyzer. |
| @@ -30,7 +31,7 @@ Provides: python3-pdfminer.six-doc | |||
| 30 | Development documents and examples for pdfminer.six. | 31 | Development documents and examples for pdfminer.six. |
| 31 | 32 | ||
| 32 | %prep | 33 | %prep |
| 33 | -%autosetup -n pdfminer.six-%{version} | 34 | +%autosetup -n pdfminer.six-%{version} -p1 |
| 34 | 35 | ||
| 35 | %build | 36 | %build |
| 36 | %py3_build | 37 | %py3_build |
| @@ -72,6 +73,9 @@ mv %{buildroot}/doclist.lst . | |||
| 72 | %{_docdir}/* | 73 | %{_docdir}/* |
| 73 | 74 | ||
| 74 | %changelog | 75 | %changelog |
| 76 | +* Tue Jun 30 2026 刘慧 <2224621664@qq.com> - 20231228-3 | ||
| 77 | +- fix CVE-2025-64512 | ||
| 78 | + | ||
| 75 | * Tue Feb 18 2025 Bijie Wu <wubijie@kylinos.cn> - 20231228-2 | 79 | * Tue Feb 18 2025 Bijie Wu <wubijie@kylinos.cn> - 20231228-2 |
| 76 | - BuildRequires python-setuptools-git-versioning | 80 | - BuildRequires python-setuptools-git-versioning |
| 77 | 81 | ||