1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//! archmeld CLI entry point.
// Upstream transitive dependencies pull in multiple
// crate versions; not fixable at the leaf crate level.
use ExitCode;
use MiMalloc;
/// Secure-mode mimalloc (skills/rust-hardening).
///
/// archmeld's whole job is parsing untrusted archive bytes, so the allocator is
/// directly on the attack path. Secure mode adds guard pages between blocks,
/// encodes free-list pointers, and randomises placement — turning several
/// classes of heap corruption from exploitable into a crash.
///
/// **Disabled under `AddressSanitizer`, deliberately.** `ASan` detects heap errors
/// by replacing `malloc`; a custom `#[global_allocator]` routes around those
/// interceptors and, per `skills/rust-asan-ubsan`, "makes `ASan` blind". Leaving
/// mimalloc installed for a sanitizer build would produce a green run that
/// checked almost nothing — the exact false-green this gate exists to prevent.
/// The feature is DEFAULT-ON, so every ordinary build and every release still
/// gets the secure allocator; only `--no-default-features` (the sanitizer
/// job) drops it. `cfg(sanitize)` would be tidier but is nightly-only, and
/// archmeld builds on stable.
static GLOBAL: MiMalloc = MiMalloc;