fix CVE-2025-64512 #28
Merged
LiuhuioooAdd on Jun 30
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 01%global _empty_manifest_terminate_build 0
2Name: python-pdfminer.six2Name: python-pdfminer.six
3Version: 202312283Version: 20231228
4-Release: 24+Release: 3
5Summary: PDF parser and analyzer.5Summary: PDF parser and analyzer.
6License: MIT6License: MIT
7URL: https://github.com/pdfminer/pdfminer.six7URL: https://github.com/pdfminer/pdfminer.six
8Source0: https://files.pythonhosted.org/packages/31/b1/a43e3bd872ded4deea4f8efc7aff1703fca8c5455d0c06e20506a06a44ff/pdfminer.six-20231228.tar.gz8Source0: https://files.pythonhosted.org/packages/31/b1/a43e3bd872ded4deea4f8efc7aff1703fca8c5455d0c06e20506a06a44ff/pdfminer.six-20231228.tar.gz
9+Patch0: backport-CVE-2025-64512.patch
9BuildArch: noarch10BuildArch: noarch
10%description11%description
11PDF parser and analyzer.12PDF parser and analyzer.
@@ -30,7 +31,7 @@ Provides: python3-pdfminer.six-doc
30Development documents and examples for pdfminer.six.31Development documents and examples for pdfminer.six.
31 32 
32%prep33%prep
33-%autosetup -n pdfminer.six-%{version}34+%autosetup -n pdfminer.six-%{version} -p1
34 35 
35%build36%build
36%py3_build37%py3_build
@@ -72,6 +73,9 @@ mv %{buildroot}/doclist.lst .
72%{_docdir}/*73%{_docdir}/*
73 74 
74%changelog75%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-279* Tue Feb 18 2025 Bijie Wu <wubijie@kylinos.cn> - 20231228-2
76- BuildRequires python-setuptools-git-versioning80- BuildRequires python-setuptools-git-versioning
77 81