OpenZL decoder, vendored for the verify-bundle guest
Heimdall is a defensive sandbox. This directory holds the C the guest compiles
into its wasm32 module so it can read OpenZL-compressed znippy members
(feature openzl, on by default). See docs/OPENZL-WASM.md for why and how.
Provenance
Copied from the published crate openzl-sys-rs 0.4.1+openzl.0.3.0 (crates.io,
the exact library Holger and znippy link), whose openzl/VENDOR.md pins:
| Component | Version | Upstream |
|---|---|---|
| OpenZL | tag v0.3.0 = commit 32246b48faee46807f84183dac4db479089f5445 | github.com/facebook/openzl |
| zstd | 1.5.7 | pinned by OpenZL's CMake |
| lz4 | 1.10.0 | pinned by OpenZL's CMake |
Licences: src/LICENSE (OpenZL, BSD-3-Clause), src/deps/zstd/LICENSE
(BSD-3-Clause), src/deps/lz4/LICENSE (BSD-2-Clause).
What is here
c-files.txt— the 115 translation unitswasm-ld --tracepulls in forZL_getDecompressedSize+ZL_decompress(decoder graph, codecs, the zstd and lz4 decompressors; no compressor exceptfse/compress/hist.c, which a decoder references).h-files.txt— the 268 headers those include (clang -MM).wasm32.patch— the ONE change: OpenZL static-asserts a 64-bitsize_tonly to keep its heap-arena header (HeapMeta) a multiple of 16 bytes; on a 32-bit target the header is padded instead and the assert dropped.shim/hzl.c— Heimdall's own C: a scalar-only ABI over the two entry points, and the five libc symbols the decoder references besides memory functions (stdio logging andvsnprintfwrite nothing;aborttraps).vendor.sh— re-createssrc/from the crate and applies the patch:openzl/vendor.sh ~/.cargo/registry/src/*/openzl-sys-rs-0.4.1+openzl.0.3.0thengit diff --stat openzl/srcmust be empty.
build.rs compiles src/ + shim/hzl.c with clang for wasm32 against
wasi-libc's headers only (no wasi-libc object is linked). malloc & co. are
the guest's Rust allocator (src/zl.rs); memcpy/memmove/memset come from
Rust's compiler-builtins.