Skip to content

Commit 431fa58

Browse files
committed
Update validation for arm64
1 parent f1a8cf2 commit 431fa58

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/validation.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use {
1818
macho::{LoadCommandVariant, MachHeader, Nlist},
1919
pe::{ImageNtHeaders, PeFile, PeFile32, PeFile64},
2020
},
21-
Endianness, FileKind, Object, SectionIndex, SymbolScope,
21+
Architecture, Endianness, FileKind, Object, SectionIndex, SymbolScope,
2222
},
2323
once_cell::sync::Lazy,
2424
std::{
@@ -118,6 +118,7 @@ const PE_ALLOWED_LIBRARIES: &[&str] = &[
118118
"libcrypto-1_1.dll",
119119
"libcrypto-1_1-x64.dll",
120120
"libcrypto-3.dll",
121+
"libcrypto-3-arm64.dll",
121122
"libcrypto-3-x64.dll",
122123
"libffi-8.dll",
123124
"libssl-1_1.dll",
@@ -138,8 +139,9 @@ const PE_ALLOWED_LIBRARIES: &[&str] = &[
138139
"tk86t.dll",
139140
];
140141

141-
// CPython 3.14 uses tcl/tk 8.6.14+ which includes a bundled zlib and dynamically links to msvcrt.
142+
// CPython 3.14 and ARM64 use tcl/tk 8.6.14+ which includes a bundled zlib and dynamically links to msvcrt.
142143
const PE_ALLOWED_LIBRARIES_314: &[&str] = &["msvcrt.dll", "zlib1.dll"];
144+
const PE_ALLOWED_LIBRARIES_ARM64: &[&str] = &["msvcrt.dll", "zlib1.dll"];
143145

144146
static GLIBC_MAX_VERSION_BY_TRIPLE: Lazy<HashMap<&'static str, version_compare::Version<'static>>> =
145147
Lazy::new(|| {
@@ -1371,15 +1373,17 @@ fn validate_pe<'data, Pe: ImageNtHeaders>(
13711373
let lib = String::from_utf8(lib.to_vec())?;
13721374

13731375
match python_major_minor {
1374-
"3.9" | "3.10" | "3.11" | "3.12" | "3.13" => {}
1376+
"3.11" | "3.12" | "3.13" if pe.architecture() == Architecture::Aarch64 => {
1377+
if PE_ALLOWED_LIBRARIES_ARM64.contains(&lib.as_str()) {
1378+
continue;
1379+
}
1380+
}
13751381
"3.14" => {
13761382
if PE_ALLOWED_LIBRARIES_314.contains(&lib.as_str()) {
13771383
continue;
13781384
}
13791385
}
1380-
_ => {
1381-
panic!("unhandled Python version: {}", python_major_minor);
1382-
}
1386+
_ => {}
13831387
}
13841388

13851389
if !PE_ALLOWED_LIBRARIES.contains(&lib.as_str()) {

0 commit comments

Comments
 (0)