From f647901a53944770a2216c210ff70ac30d6d0fea Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Tue, 17 Dec 2024 22:25:21 +1100 Subject: [PATCH] Extract tar files with "data" filter in Python >= 3.12 --- winbuild/build_prepare.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/winbuild/build_prepare.py b/winbuild/build_prepare.py index e702c7014d7..533d9d4771f 100644 --- a/winbuild/build_prepare.py +++ b/winbuild/build_prepare.py @@ -520,7 +520,10 @@ def extract_dep(url: str, filename: str, prefs: dict[str, str]) -> None: if sources_dir_abs != member_prefix: msg = "Attempted Path Traversal in Tar File" raise RuntimeError(msg) - tgz.extractall(sources_dir) + if sys.version_info <= (3, 11): + tgz.extractall(sources_dir) + else: + tgz.extractall(sources_dir, filter="data") else: msg = "Unknown archive type: " + filename raise RuntimeError(msg)