Skip to content

Commit 759c303

Browse files
radarherehugovk
authored andcommitted
Extract tar files with "data" filter in Windows build scripts (python-pillow#8606)
Co-authored-by: Andrew Murray <[email protected]> Co-authored-by: Hugo van Kemenade <[email protected]>
1 parent 2c71529 commit 759c303

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

winbuild/build_prepare.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import shutil
88
import struct
99
import subprocess
10+
import sys
1011
from typing import Any
1112

1213

@@ -507,7 +508,10 @@ def extract_dep(url: str, filename: str, prefs: dict[str, str]) -> None:
507508
if sources_dir_abs != member_prefix:
508509
msg = "Attempted Path Traversal in Tar File"
509510
raise RuntimeError(msg)
510-
tgz.extractall(sources_dir)
511+
if sys.version_info >= (3, 12):
512+
tgz.extractall(sources_dir, filter="data")
513+
else:
514+
tgz.extractall(sources_dir)
511515
else:
512516
msg = "Unknown archive type: " + filename
513517
raise RuntimeError(msg)

0 commit comments

Comments
 (0)