Skip to content

Threat model

What this project assumes about the bytes it is handed, what it guarantees when those bytes are hostile, and what it does not. Written for someone deciding whether to link a decoder (AC-3, E-AC-3 or AC-4) into a media server, a set-top box or a browser and point it at input from the internet.

Nothing here is a promise of invulnerability. It is a statement of posture — where the trust boundary sits, what is checked, what is only structurally bounded, and where the gaps are — so that an embedder can reason about the remaining risk instead of guessing at it.

The reporting process is in SECURITY.md; Reporting an issue below adds what an embedder specifically should send.

Trust boundary

Untrusted. Everything on this list is treated as adversary-controlled. Each has a parser in this repository that must not crash, read out of bounds, or loop unboundedly on any input:

Input Entry point Fuzzed
AC-3 elementary streams iclforge::ac3::split_frames, iclforge::ac3::FrameDecoder::decode_frame yes
E-AC-3 elementary streams, including dependent substreams iclforge::ac3::split_access_units, iclforge::ac3::Eac3Decoder::decode_access_unit yes
AC-4 elementary streams: sync frames and the table of contents iclforge::ac4::scan, iclforge::ac4::SyncFrameSplitter, iclforge::ac4::parse_raw_frame yes — fuzz_ac4_parse
AC-4 substreams: the syntax layer and the reconstruction to PCM iclforge::ac4::Decoder::parse, iclforge::ac4::Decoder::decode, decode_by_block yes — fuzz_ac4_decode
TrueHD and MLP elementary streams: the units, major syncs, restart and block headers, filters, matrices and residuals iclforge::truehd::ElementaryReader, iclforge::truehd::Decoder::decode fuzz_truehd_parse, fuzz_truehd_decode and fuzz_truehd_encode, in tools/fuzz/run.sh's default target list, with seeds made from testdata/truehd, a dictionary of the sync words and a mutator that puts the stream's checks right after each mutation; fuzz_differential_truehd_decode decodes the same bytes with FFmpeg and compares the samples, and holds three regressions
TrueHD in an IEC 61937 MAT burst, and in MP4, Matroska and MPEG-TS iclforge::containers::iec61937::unwrap_mat_stream, and the three demuxers the demuxers are fuzzed as above, each with a TrueHD seed (truehd-mono48.*); fuzz_mat_unwrap is in run.sh's default list, with three seeds (libs/containers/fuzz/seeds/fuzz_mat_unwrap/) and a dictionary of the preamble and the three code words; the MP4 demuxer's seeds include protected TrueHD and mlpa files
An AC-4 content signature (Thrift, DER, X.509, PEM, the credentials, and where the sync frames stop) iclforge::base::crypto::verify_content_signature, iclforge::ac4 io/content_signature.hpp yes — fuzz_content_signature, fuzz_ac4_content_signature (both in run.sh's default list; the changelog entry for the signature says they had not yet run under libFuzzer when it was written)
Format sniffing before any decoder commits iclforge::ac3::io::scan yes
Metadata edit and insert, which read a syncframe's header and then write it iclforge::ac3::io::edit_stream_metadata, iclforge::ac3::io::insert_stream_metadata yes - driven by fuzz_scan on the same seeds
EMDF containers in a skip field (§H.2.2) iclforge::objects::emdf::parse_container yes — fuzz_emdf_parse, plus indirectly through the E-AC-3 harnesses
OAMD object metadata (TS 103 420 §5.5) iclforge::objects::oba::parse_payload yes — fuzz_oamd_parse, plus indirectly through the E-AC-3 harnesses
JOC payloads (TS 103 420 §6) iclforge::ac3::oba::joc::parse_payload yes — fuzz_joc_parse, plus indirectly through the E-AC-3 harnesses
WAV / RIFF headers and PCM iclforge::ac3::io::read_wav, iclforge::ac3::io::WavStreamReader yes
IAB (SMPTE ST 2098-2) elementary streams and MXF track files iclforge::iab::parse_iabitstream, iclforge::iab::parse_mxf_iab, iclforge::iab::parse_iaframe yes — fuzz_iab_parse
IEC 61937 bursts off an S/PDIF or HDMI capture, AC-4's included, and the AC-4 sync frames the AC-4 packer reads iclforge::containers::iec61937::BurstReader, iclforge::containers::iec61937::read_ac4_sync_frame yes — fuzz_iec61937_unwrap
ADM XML + BW64/RF64 (opt-in build) iclforge::adm::parse_bw64, via vendored libadm/libbw64 opt-in only — fuzz_adm_parse exists but is built only under ICLFORGE_BUILD_ADM; see ADM
Object authenticity tags iclforge::ac3::signing::verify_atmos_frame yes — fuzz_signing_verify (the key is part of the fuzzed input)
Matroska/WebM containers iclforge::containers::matroska::demux, iclforge::containers::matroska::Reader yes
MP4/ISOBMFF containers, a protected (Common Encryption) track's sinf, frma, schm and tenc boxes included; the reader refuses such a track by name and decrypts nothing iclforge::containers::mp4::demux, iclforge::containers::mp4::Reader, iclforge::containers::mp4::demux_seekable yes — fuzz_mp4_demux, whose seeds include seven protected files
MPEG-TS containers iclforge::containers::mpegts::demux, iclforge::containers::mpegts::Reader yes
OSC control packets (UDP), a live object-position source iclforge::objects::oba::parse_osc_packet yes — fuzz_osc_parse, part of tools/fuzz/run.sh's default target list alongside the other object/metadata-layer harnesses
Sendspin's handshake messages from a network peer (Hearth build) iclforge::sendspin::handshake yes — fuzz_sendspin_handshake
Sendspin's messages after the handshake, JSON included (Hearth build) iclforge::sendspin::json::Document::parse, the readers in iclforge::sendspin::messages, pairing_messages, iclforge and the other roles' namespaces yes — fuzz_sendspin_json, fuzz_sendspin_messages
Sendspin's fragments and binary messages: player@v1's audio chunks, _iclforge_player@v1's bursts, and the artwork, visualizer and source messages (Hearth build) iclforge::sendspin::Reassembler, parse_player_chunk, parse_burst_chunk, artwork::parse_message, visualizer::parse_frame, source::parse_chunk yes — fuzz_sendspin_frames
mDNS packets on the local network (Hearth build) iclforge::sendspin::discovery::mdns_packets::parse, over mjansson's mdns no — see Sendspin
WebSocket frames (Hearth build) cpp-httplib, behind iclforge::sendspin::transport::websocket no — third-party; see Sendspin

Trusted. These are the caller's own inputs, and a caller that gets them wrong is a bug in the caller, not an attack:

  • Encoder configuration (EncoderConfig, eac3::FrameConfig, AtmosEncoder settings, iclforge::ac4::EncoderConfig, the forge command line). Illegal combinations are rejected with a FrameError (AC-4: EncodeError::kInvalidConfig, with the rule named by Encoder::refusal_reason()), but the values are not assumed hostile.
  • PCM handed to the encoder. Any float is legal audio; nothing about it can reach a decision the bitstream syntax does not already bound.
  • The signing key, if an operator supplies one. It is never generated, logged or written to disk by this code (iclforge::base::crypto::SigningKey zeroizes on destruction).
  • File paths, output destinations, and the caller-owned spans the _into decode forms write through — see Raw-pointer boundaries.

No remaining undefended container. Matroska/WebM, MP4/ISOBMFF and MPEG-TS all had a reader land and are in the untrusted table above; each container this project also writes now has a matching demuxer this project defends. An embedder demuxing a container format this project does not read — or write, such as a bare Ogg or ADTS wrapper — is still trusting its own demuxer, not this one.

Memory-safety posture

The codec core is first-party C++23. It takes in two third-party libraries. {fmt} builds text the library writes out: version and diagnostic strings, timecodes, and the scene and census JSON. nlohmann/json tokenises the one file the library reads as JSON, an object scene (libs/objects/src/scene_json.cpp, the only file that includes it): it is header-only and compiled in privately, the library calls only its non-throwing parse so a malformed file is a SceneError and never an exception, and which members may appear, and how often, is checked by first-party code. Neither is included by a file that defines an entry point in the table above (a scene is a file the user names, not a stream). C++ is not a memory-safe language, so the posture is a set of specific properties rather than a language guarantee:

  • Bit reading cannot run off the end. The AC-3, E-AC-3 and object-layer parsers share iclforge::BitReader, and the AC-4 inspector and decoder each have a reader of their own with the same design. Reading past the end sets a sticky flag (overflowed()) and yields zeros rather than touching memory; parsers check the flag at a frame or payload boundary instead of guarding each read. A truncated or hostile frame therefore decays into a kTruncated (DecodeError::kTruncated; iclforge::ac4::Error::kTruncated from the AC-4 inspector) rather than an over-read. The IAB reader (iclforge::iab) is the exception to the design: its reader returns a std::expected from every read.
  • Every fallible path returns a value, not an exception. std::expected<T, DecodeError> throughout (iclforge::ac4::DecodeError for the AC-4 decoder). The codec core does not throw; the only exceptions that can escape it are std::bad_alloc from an allocation it makes.
  • No owning raw pointers, no manual new/delete, no C string handling in the codec core. Buffers are std::vector; borrowed views are std::span and std::string_view.
  • Indexed access is std::span and std::vector, which are bounds-checked only where the standard library's own assertions are on — MSVC's _STL_VERIFY in a debug build, and libstdc++/libc++ only under _GLIBCXX_ASSERTIONS/_LIBCPP_HARDENING_MODE, neither of which this project sets. The CI builds that are debug builds are the two sanitizer legs, the coverage job and the shared-library pass, and all four run in the nightly run, not in the pull-request gate or after a merge. The ASan + UBSan leg is also the one that runs the codec matrix, so an out-of-range index there fails the job (the TSan leg is debug too, but runs only the concurrency label — see below). Every other leg, and every shipped package, is a release build with no such net — which is why the fuzzers run under ASan rather than relying on the library's own checks. (The WAV over-read fixed alongside this document is exactly that story: caught by _STL_VERIFY in a debug build, invisible in a release one.)

What runs against it:

  • Thirty-two libFuzzer harnesses under fuzz/, built with ASan + UBSan and -fno-sanitize-recover=all. Twenty-seven are in tools/fuzz/run.sh's default list and drive the entry points in the table above for crashes and undefined behaviour — format sniffing and the metadata edit and insert (fuzz_scan), the three container demuxers (fuzz_matroska_demux, fuzz_mp4_demux, fuzz_mpegts_demux), the AC-3 and E-AC-3 decoders (fuzz_ac3_decode, fuzz_eac3_decode), AC-4's inspector and decoder (fuzz_ac4_parse, fuzz_ac4_decode), WAV (fuzz_wav_read), IEC 61937 burst de-framing (fuzz_iec61937_unwrap), the IAB reader (fuzz_iab_parse), the three object/metadata parsers behind the skip field (fuzz_emdf_parse, fuzz_oamd_parse, fuzz_joc_parse), the signature verifier (fuzz_signing_verify), the OSC parser (fuzz_osc_parse) and Sendspin's four (fuzz_sendspin_json, fuzz_sendspin_handshake, fuzz_sendspin_messages, fuzz_sendspin_frames) — and fuzz_ac4_encode, which runs the AC-4 encoder over the configurations and input it takes and holds it to the decoder. Two press an AC-4 stream's content signature, which arrives with the file it signs: fuzz_ac4_content_signature (where the sync frames stop and what the digest covers) and fuzz_content_signature (the Thrift, DER, X.509, PEM and credential readers, and the verifier that joins them; a trusted-key file is read by the same PEM and DER code). A signature made with the operator's own key authenticates nothing to Dolby: it does not chain to Dolby's or PACE's trust root, and what a verifier here concludes is only what the keys and certificates it was given vouch for (Object signing). Four are TrueHD's and the MAT unwrapper's: the reader, the decoder and the encoder (fuzz_truehd_parse, fuzz_truehd_decode, fuzz_truehd_encode, with seeds made from the fixtures and the hand-built streams, a dictionary and a mutator that rewrites the stream's checks) and fuzz_mat_unwrap. Three more (fuzz_differential_ac3_decode, fuzz_differential_eac3_decode, fuzz_differential_truehd_decode) decode the same mutated bytes with FFmpeg as well and diff the PCM (TrueHD's sample for sample, since the codec is lossless), so a wrong decode that does not crash is caught too. fuzz_adm_parse is built only when ICLFORGE_BUILD_ADM is on — see ADM — and the last, fuzz_iamf_parse, reads IAMF's OBU stream and its ISO-BMFF encapsulation from 17 seeds (a 7.1.4 PCM programme, object programmes in the three position codings, a fragmented file, and Opus, AAC-LC and FLAC ones, each in both framings), made by iclforge-iamf-seed-tool. Fuzz Regress replays the checked-in seed and regression corpora on every push to main and on pull requests into it (a repository variable can pause the pull-request run, as Where each check runs says); Fuzz Short and Fuzz Differential add a bounded mutation budget on pushes, and a nightly job goes deeper.
  • An ASan + UBSan CI leg that runs the full test suite and tools/ci/run_codec_matrix.sh — every layout, every Annex E tool token, both Atmos container modes, the metadata options — so the sanitizers see the real command paths rather than only unit tests. It is a nightly leg.
  • A ThreadSanitizer leg. The codec core is single-threaded and holds no shared state, but the audio layer's lock-free SPSC ring, silence watchdog and drift servo are shared between a real-time callback thread and an encoder thread, and neither ASan nor UBSan can see a race there — the two runtimes are also mutually exclusive, so it is a separate leg (Linux LLVM TSan, a deep-tier leg in .github/ci/legs.jsonc, so it runs in the nightly run; preset linux-llvm-tsan) rather than more entries on the one above. It runs the concurrency ctest label only — the audio layer's tests (libs/audio/tests/), forge live's (apps/forge/cli/tests/test_cli_live.cpp) and the Hearth tests that carry the tag — because TSan's shadow memory makes everything several times slower and the rest of the suite is single-threaded codec maths. tsan.supp at the repository root holds the suppressions and is near-empty.
  • CodeQL on the security-and-quality suite (less its advisory queries and two that misfire here, filtered in .github/codeql/codeql-config.yml; the C++ leg builds the shipped code without the tests and the examples), MSVC PREfast and clang-tidy, all run nightly against main rather than per pull request; a run that finds something new opens a nightly-analysis issue, and the alerts themselves are triaged in Security > Code scanning. SonarCloud runs in the same window for maintainability, duplication and coverage on new code, plus bug and vulnerability detection; its BUG and VULNERABILITY findings are also triaged in Security > Code scanning (tools/ci/sonar_to_sarif.py converts them, since SonarCloud has no server-side option to publish there itself), but maintainability findings, duplication, coverage and the quality gate status stay in its own dashboard only. OSV scanning (on pull requests, pushes to main and a weekly schedule; the pull-request run pauses with the same variable) and OpenSSF Scorecard (pushes to main and a weekly schedule) upload to the same tab.

What is not covered by that leg: anything threaded that is not tagged concurrency. The label comes from the Catch2 tags themselves (catch_discover_tests(... ADD_TAGS_AS_LABELS)), so a race in code whose tests carry a different tag — or in a path with no test at all — is outside what TSan sees on any run, and adding a case to the leg means tagging it.

Known history in this class: one real bug of exactly this shape has been found and fixed (commit 8386c8f — a decoder that shifted by an unvalidated exponent and reached undefined behaviour on a malformed differential exponent chain). It was found by a manual adversarial audit; the fuzzers exist because that audit should not have been the thing that found it.

Raw-pointer boundaries

Three surfaces cross out of C++ into a caller that the type system cannot help. Each has a contract the caller must keep; none of them validate it in a release build.

The C API (iclforge_c/iclforge.h)

The safest of the three, by design. Every handle is opaque, every fallible call returns iclforge_status_t, and nothing is returned through a caller-supplied buffer — a variable-length result is an owned handle read through accessors, so no caller has to predict a size. Every entry point is wrapped in a noexcept guard that turns std::bad_alloc into ICLFORGE_ERROR_OUT_OF_MEMORY and anything else into ICLFORGE_ERROR_INTERNAL, because letting a C++ exception unwind into a C (or Rust, or Python) frame is undefined behaviour.

What the caller still owns:

  • Lifetime. Every _create needs its _destroy. Passing NULL to a _destroy is a no-op, matching free().
  • The const uint8_t* frame / size_t frame_size pair every decode entry point takes (iclforge_decoder_decode_frame, iclforge_ac4_decoder_decode and the rest). A size larger than the buffer is a caller bug this layer cannot detect; the buffer must be valid for the whole call.
  • Accessor indices. iclforge_decoded_frame_channel_samples(frame, channel_index) and friends take an index the caller is expected to have read from iclforge_decoded_frame_channel_count first.
  • No ABI promise before v1.0. A newer ICL Forge may need a recompile, not merely a relink.

The _into decode forms

FrameDecoder::decode_frame_into and Eac3Decoder::decode_access_unit_into write PCM into caller-owned planar spans instead of allocating. The span count and each span's length are checked by assert — which means they are checked in a debug build and not at all in a release build, where an undersized span is a buffer overflow in the caller's memory. The contract is on both functions' doc comments: one span per channel the frame codes (six covers every AC-3 layout, sixteen covers §E3.8.2's cap for E-AC-3), each holding kSamplesPerFrame floats. Use the allocating forms if the sizes are not statically obvious.

The WASM bindings and the JNI bridge

The WASM decoder (apps/demos/wasm/decoder_bindings.cpp) copies the JavaScript byte array into a std::vector before parsing, so the decode itself never reads JS-owned memory. What it hands back is a zero-copy typed_memory_view into the decoder instance's own buffers: those views are invalidated by the next decode() call or by the instance's destruction, and JavaScript holding one past that point reads freed WASM heap. The module is built with ALLOW_MEMORY_GROWTH under a 1 GiB MAXIMUM_MEMORY ceiling, which turns heap exhaustion into a catchable std::bad_alloc and a readable refusal instead of a dead tab.

The AC-4 bindings (apps/demos/wasm/ac4_bindings.cpp) have the same shape. The decoder copies the JavaScript byte array before parsing and returns each frame's channels and object samples as typed_memory_views, valid until that instance's next call. The encoder copies every frame it returns into a Uint8Array of its own, because one call can return several.

The Android JNI bridge (apps/demos/android/app/src/main/cpp/) is demo-app scope: it returns strings through NewStringUTF and does not take byte arrays across the boundary, so it has no GetByteArrayElements-style pinned-buffer contract to get wrong. It is not part of the library's supported surface.

Resource limits

For AC-3 and E-AC-3 the important structural property is that every per-access-unit allocation is bounded by a bitstream field of fixed width, so no single frame can be made to consume an unbounded amount of memory or time. Decode cost is linear in the number of access units, with a bounded cost per unit; there is no super-linear amplification and no recursive descent anywhere in the parsers. The OSC bundle walker (below) extends that same guarantee to network input rather than carving out an exception to it: arbitrarily nested bundles are walked with an explicit stack and a hard depth cap instead of function recursion, by construction rather than by convention. AC-4's syntax leaves more open, and its own subsection says what holds there.

Enforced limits, and where they come from:

Quantity Limit Enforced by
AC-3 syncframe 3,840 bytes Table 5.18 (frmsizecod indexes a fixed table; 38–63 rejected as reserved)
E-AC-3 syncframe 4,096 bytes frmsiz is 11 bits; (frmsiz + 1) * 2
E-AC-3 syncframe, lower bound 6 bytes explicit refusal: a frmsiz that does not cover the header it was read from is kInvalidStream, not a short span someone reads past
Coded channels per substream 6 (5 full-bandwidth + LFE) acmod/lfeon are 3 + 1 bits
Rendered channels per access unit 16 §E3.8.2
Substream identities held simultaneously 32 strmtyp (2 bits) × substreamid (3 bits); a flat 32-slot array, states lazily allocated
Overlap-add state per identity 12 KiB 6 channels × 256 doubles
Samples per access unit 1,536 per channel kSamplesPerFrame
PCM per access unit 96 KiB 16 channels × 1,536 × sizeof(float)
EMDF skip field 511 bytes skipl is 9 bits
EMDF payload bounded against the bits actually left before allocating explicit check in parse_container — a variable_bits size field could otherwise claim gigabytes from a few dozen bits of garbage
addbsi 64 bytes addbsil is 6 bits
OAMD objects 32 object_count_bits is 5 bits; §5.5.2's escape for larger counts (0x1F plus a 7-bit extension) is refused rather than implemented
JOC objects 16 kMaxObjects, checked explicitly; TS 103 420 §8.3.2.2's own cap
OSC receive buffer 65,535 bytes LivePositionSource's kRecvBufferSize, sized above the 65,507-byte IPv4 maximum a UDP datagram can ever carry — UDP's own length field is 16 bits, so nothing legal is ever larger
OSC bundle nesting 8 levels parse_osc_packet's iterative bundle walk (kMaxBundleDepth); a bundle nested past the cap is dropped whole rather than descended into
Live OSC per-object mailbox 1 pending update per session object slot LivePositionSource, sized once at construction from the same object-slot budget as "JOC objects" above (at most 15 dynamic objects; TS 103 420 §8.3.2.2 caps the total at 16 once the bed's LFE is counted)
WASM demo heap 1 GiB MAXIMUM_MEMORY, with std::bad_alloc caught and reported

A hostile frmsiz

Worth spelling out because it is the field an attacker reaches for first. frmsiz says how long an E-AC-3 syncframe is, and callers index into the spans the splitter hands back:

  • A frmsiz larger than the bytes remaining is DecodeError::kTruncated. The splitter never returns a span that overruns the input.
  • A frmsiz smaller than the six header bytes already read is DecodeError::kInvalidStream — refused outright rather than becoming a short span a later parser reads past.
  • A frmsiz that is merely wrong — self-consistent, but not where the next syncframe actually is — desynchronises the split, and the following frame fails its sync-word check. Nothing reads outside the input span in the meantime.

The AC-3 equivalent is frmsizecod, which indexes a fixed table rather than carrying a length: values 38–63 are reserved and rejected, and fscod == 3 is rejected, so the frame size is always one of 38 tabulated values.

Limits for AC-4

AC-4 frames are sized by a 16-bit field with a 24-bit escape, and the syntax inside them leaves counts open that AC-3 and E-AC-3 fix, so the guarantee above is narrower here. What the AC-4 libraries enforce:

Quantity Limit Enforced by
AC-4 sync frame 16,777,215 bytes, plus a 7-byte header and a 2-byte CRC frame_size is 16 bits, or 24 when the 16-bit field reads 0xFFFF (iclforge::ac4::scan)
Frames handed back spans into the input, or into storage the caller supplies iclforge::ac4::scan copies no frame; iclforge::ac4::SyncFrameSplitter reports kBufferTooSmall rather than growing its storage
Objects in an OAMD portion 64 kMaxOamdObjects; a larger count is refused as unsupported however large the stream says it is
Leading ones in an ext_code escape 8 Table 40 gives the escape 21 bits at most; a ninth leading one refuses the frame

variable_bits() has no limit on the number of groups in the standard, and the decoder sets none: the loop ends at a clear continuation flag or at the end of the substream, the value is kept modulo 2^64, and a size built from it is compared with what is left of the substream rather than looped over. What holds the rest of the property is the harness, not a table: fuzz_ac4_decode is written to fail on any read outside a substream, any loop on a count with no data behind it and any sanitizer report, and it found the ext_code loop above, which the decoder had left unbounded. There is no measured worst-case expansion ratio for AC-4.

Open gaps

No cap on stream length, and no streaming split in the CLI. iclforge::ac3::io::scan, iclforge::ac3::split_frames, iclforge::ac3::split_access_units and iclforge::ac4::scan take the whole elementary stream as one std::span and return one span per access unit. Peak memory is therefore O(input size) — the bytes themselves plus an index entry per access unit — and there is no limit at which the library refuses. forge inherits this: it reads the encoded input fully into memory (it streams the decoded PCM out, so output is O(1)).

This is deliberate rather than overlooked: what counts as "too large" is the embedder's policy, not the library's, and a hard cap in the library would break legitimate long-file use. The mitigation is on the caller:

  • Bound the input before calling. A length limit, a container-level packet budget, or a memory cgroup are all more appropriate than a constant compiled into a codec.
  • Or drive the per-frame API directly. FrameDecoder::decode_frame and Eac3Decoder::decode_substream/decode_access_unit each take one unit at a time, and the _into forms write into caller-owned storage, so a caller that delimits units itself never needs the whole stream resident. iclforge::ac3::io::AccessUnitAccumulator (AC-3, E-AC-3) and iclforge::ac4::SyncFrameSplitter (AC-4) do the delimiting incrementally in storage the caller owns; the ESP32 player uses the first, and neither is used by forge.

No decode time bound. Nothing in the library measures or limits wall-clock time. Because per-unit cost is bounded and the parsers do not recurse or backtrack, total decode time is linear in input length — there is no input that makes a single frame slow. Watchdog the call if the threat is a peer feeding an endless stream; there is nothing to configure here.

Worst-case expansion ratio. A minimum-size access unit is 6 bytes and a maximum-size one produces 96 KiB of PCM, so the structural upper bound on decoded-bytes-per-input-byte is roughly 16,000:1. That is an upper bound from field widths, not a measured achievable figure — a frame short enough to hit it does not carry enough bits to code channels at all, and overflows the bit reader into kTruncated first. Bound decoded output, not input bytes, if this matters.

A WAV file is read whole. iclforge::ac3::io::read_wav reads its entire source into memory before parsing, so memory is O(file). iclforge::ac3::io::WavStreamReader is the block-at-a-time alternative and reads only a fixed header window (a data chunk beyond that window is refused rather than searched for). A WAV may declare up to 65,535 channels; the per-channel vector overhead that implies (~1.5 MB) is not proportional to the file that declared it, though the sample data itself is still clamped to the bytes actually present.

ADM XML and BW64

atmos-adm and iclforge::adm:: are off by default (-DICLFORGE_BUILD_ADM=ON) and, unlike every other parser here, are not this project's own code: the XML and BW64/RF64 reading is vendored libadm and libbw64, plus Boost headers. That means:

  • The fuzz harness that covers this path is opt-in, not continuous. fuzz_adm_parse drives iclforge::adm::parse_bw64 over BW64 chunks plus an arbitrary XML document, but it is built only when ICLFORGE_BUILD_ADM is on (tools/fuzz/run.sh turns that on via ICLFORGE_FUZZ_ADM=1), and the one CI job that runs it — Fuzz ADM Nightly — is schedule/dispatch-only and continue-on-error, because a vcpkg restore plus the libbw64/libadm FetchContent pulls cost more than the mutation budget and most of what the harness reaches is third-party code. It is not one of the twenty-seven harnesses in tools/fuzz/run.sh's default list, which run on every push. The resource limits above do not apply here either way: there is no document-size cap, no entity-expansion limit and no element-count limit; an enormous or deeply nested ADM document is bounded by nothing this project controls.
  • libbw64 is fetched from a maintained fork, not the EBU's own repository. The EBU's github.com/ebu/libbw64 last tagged a release in January 2019 (0.10.0); its own master branch is 77 commits ahead of that tag, and its changelog describes those commits as fixing "a number of buffer overruns, integer overflows, and uses of uninitialised data which may be triggered by reading malformed files", but has tagged no release containing them. This module pinned 0.10.0 at first and patched around the gap (libs/adm/patch_libbw64.cmake, adm.cpp's own pre-check) as fuzz_adm_parse and an audit of libbw64 for the same pattern found an unbounded allocation, an unbounded loop, a read of uninitialised stack and a <ds64> table that could resize a chunk other than <data> to whatever it liked. github.com/pwnified/libbw64, an active single-maintainer fork, carries the EBU's own unreleased hardening forward and closes all of that — confirmed by replaying every crafted input from that investigation clean, not just by reading its source — plus real hardening of its own; docs/library/adm.md's "Built on the EBU's own reference implementations" section has the reasoning for depending on a fork rather than the EBU directly, and tools/fuzz/README.md's ADM section has the measurements. The fork's own commit is pinned (not a branch), the same way the tag used to be. Two small patches remain against it, for behaviours this module's tests need that the fork does not have by default: a truncated recording still parsing, and 64-bit float actually reaching the decode the fork's own utilities already support (its <fmt > parsing refuses any 64-bit width outright, PCM or float, before that decode is ever called) — see patch_libbw64.cmake's own comment, which also links the PRs proposing the same fixes upstream.
  • The whole axml chunk is materialised as a string and re-parsed from an istringstream, so memory is O(document).
  • Parse and graph-resolution failures do surface as real diagnostics (iclforge::adm::AdmError, iclforge::adm::BridgeError, each with its own describe()) rather than a crash or a bare non-zero exit.

Do not enable the ADM build for untrusted input. It exists to ingest professional master files an operator already trusts. Extending the threat model to cover it means putting the vendored parsers under the same every-push fuzzing the rest of the table gets, not a nightly advisory job, and deciding a document-size policy; neither has been done.

Object signing is authentication, not integrity of the stream

iclforge::ac3::signing::verify_atmos_frame/verify_atmos_stream (and their keyring forms, verify_atmos_frame_any/verify_atmos_stream_any) check an HMAC tag over the frame's audio and its EMDF object container together. This tells you the frame's object metadata and the audio it was signed with came from someone holding a key of the set. What the tag leaves out is the framing words, a few metadata flags, every skip field's own bytes and the CRC — which is why a frame is reported valid only when the container is the whole of its object layer: a second payload in another skip field, or bytes trailing the container, would be unauthenticated and so is a mismatch. A stream with no container at all has nothing to verify — see Object signing. Verification is opt-in (forge decode ... verify-objects, or gate-objects to play the bed where it does not verify); a signed-but-unchecked stream decodes exactly like an unsigned one. This project ships no key.

OSC live-position input has no authentication or encryption

positions=osc:<port> (forge live mode=atmos) and the GUI live room's "Drive objects from OSC" toggle open a plain UDP socket. OSC 1.0 has no authentication or encryption of its own, and this project adds neither: anyone who can reach the bound address and port can send /object/<n>/xyz and move that object, full stop. The source IP is not checked — UDP has no connection to check it against, and it is trivially spoofable regardless — so "only my show-control rig sent that" is never a guarantee this layer gives an operator.

The default bind is loopback (127.0.0.1): a session accepts datagrams only from the machine running it unless the operator explicitly widens that — positions=osc:any:<port> on the CLI, or the GUI's "any interface" checkbox, both of which bind 0.0.0.0 instead. This is opt-in surface on top of opt-in surface: a session listens for OSC at all only when positions= (or the GUI toggle) is explicitly used, and listens on every interface only when that is explicitly widened too.

What a successful spoof or injection buys an attacker is narrow. iclforge::objects::oba::apply (libs/objects/src/scene_osc.cpp) merges only position, gain and lfe_send onto an object's existing placement, or releases it back to its authored automation (/object/<n>/release) — there is no path from this input to encoder configuration, to the filesystem, or to anything outside the object placements themselves. The blast radius of a successful attack is "objects move to wherever the packet says," never a compromised process.

Sendspin: Hearth's server and its sinks

libs/sendspin, built only with ICLFORGE_BUILD_HEARTH, listens on the local network. A sink (hearth-testsink on a computer, or hearth_sink on an ESP32-S3, ESP32-C6 or ESP32-P4 board) accepts WebSocket connections on port 8928 and advertises _sendspin._tcp; Hearth's server listens on 8927, advertises _sendspin-server._tcp, and dials the players it finds. Anyone on the network can open a connection to either, and anyone can send them mDNS packets.

A peer without a key reaches the handshake and little more. After the handshake's text frames, every message is sealed with Noise KKpsk2 under a PSK both ends hold: a pairing record's long-term PSK, a device's pairing PSK, or the Sentinel, whose value is public. Under the Sentinel a connection can pair; it can play only on a player that offers unpaired access (off by default on the test sink), and Hearth's server starts playback there only for a client its operator has approved. What such a peer can still do:

  • Guess a pairing code, a bounded number of times. Code pairing runs CPace over the handshake's hash, so a wrong guess gives nothing to test further codes against offline. A dynamic code allows at most 20 rounds before the device's operator resets the limit. A static code is accepted only in a five-minute window a gesture on the device opens, for at most five failures, and only on the connection that carried the window's first attempt.
  • Show the server's operator a sentence. A player's client/pair-pending message reaches the operator as text from an unauthenticated device, cut to 800 bytes.
  • Use connections, memory and time. The server's listener takes 32 connections and the test sink's 4; a handshake, or a wait for the first activation, that stalls is closed after 30 seconds; a message is refused at 4 MiB before anything is allocated for it; and a peer that stops reading is disconnected once 8 MiB wait to be sent to it. There is no limit on connection attempts from one address beyond these.

A key is the credential. A device's pairing PSK token (SP:0...) pairs whoever enters it into a server; the test sink prints its own at start. A paired server can play audio and send the commands a player lists: volume, mute and output delay, and over _iclforge_player@v1 the settings a sink admits. What a sink decodes is an elementary stream from that server, and meets the decoder's posture above. The test sink keeps its identity key, pairing PSK and pairing records as files in its state directory, readable and writable by their owner only where the file system supports it.

mDNS is unauthenticated. A host on the network can advertise a service pointing at any address and port, and Hearth's server dials it every ten seconds while it is advertised. The handshake fails unless that address holds a key the server accepts, but the connection attempt goes out. A browser remembers at most 64 instances and hosts, and reads packets of at most 9,000 bytes.

Not fuzzed. The mDNS packet reader and cpp-httplib's WebSocket framing sit outside tools/fuzz/run.sh's build, which keeps the Sendspin library's core free of vcpkg dependencies. The packet reader has unit tests over packets that end early and names that point at themselves; the WebSocket framing is cpp-httplib's own code.

A board's page and REST API have no authentication. hearth_sink serves its page and routes on port 80 beside the player, and whoever can reach that port can do what they allow without a key:

  • play any HTTP URL, stop a play, and set the volume;
  • change the board's name, layout, slot width and wiring, and the network it joins at its next restart (PUT /network, whose body carries the passphrase in clear over HTTP);
  • forget every pairing, which gives the board a new identity, or one server's pairing, and lift the limit on wrong pairing codes;
  • read which servers the board is paired with (GET /pairing): each one's name, as its own hello gave it, and its server_id, which is its public key;
  • read the network the board is on (its SSID, signal and address) and its firmware's version;
  • read GET /status, including the pairing code while a pairing runs. So on a board, pairing by code shows only that the server's operator can reach the page, and anyone who can reach it can pair a server of their own. The network is the boundary for pairing, as it is for the rest. The pairing token pairs with no code at all, and only the console prints it.

A page on another site, opened by someone on the same network, can send the board requests that need no CORS preflight, such as POST /play with a text body. Forgetting one server that way needs its whole server_id, which such a page cannot read from GET /pairing. That exposure is left as it is. The page puts every string from /status into the document as text, never as markup.

A board keeps its keys in NVS, unencrypted. Its X25519 identity, its pairing PSK, up to eight pairing records with their servers' names, and the Wi-Fi passphrase are in the NVS partition, and these builds turn on neither NVS encryption nor flash encryption. Whoever holds the board can read them with esptool, and with them pass as the board to every server it paired with, or join its network. Turning on both is the integrator's choice, and no build here has tried it.

The console is trusted. Anyone with the board's USB port can read its pairing token, give it a network over Improv Wi-Fi, and type pair forget or pair reset.

A board's limits are its own. The player holds three connections at once. It closes a connection that sends a message larger than its largest chunk (CONFIG_ICLFORGE_EXAMPLE_SENDSPIN_MAX_CHUNK_BYTES, 25,600 bytes by default) before storing it. A JSON message of more than 512 values (PlayerConfig::max_json_tokens, set to kSinkMaxJsonTokens), five times the 98 of the largest a server sends, is dropped before any storage is taken for it: a valid 4 KB text of two thousand one-digit values, which would need one 32 KB block that a C6 with Wi-Fi up cannot give and whose failure aborts, costs the board its count and nothing else. A chunk that does not fit the ring between the network and the decoder is dropped and counted. A chunk of the wrong type, or a unit that fails to decode, is counted as invalid, and the decoder starts again at the next burst. The decoder meets the posture above.

What a decode failure looks like

Every decode entry point returns std::expected<..., DecodeError>. The AC-3 and E-AC-3 decoders' error is one of seven values: kTruncated, kBadSyncWord, kBadCrc, kReservedValue, kUnsupported (a bsid this decoder does not read), kInvalidStream or kNoReferenceTransform (a build without the direct-form transform, asked for it). iclforge::ac3::describe() turns each into a sentence. The AC-4 decoder's iclforge::ac4::DecodeError has five: kTruncated, kInvalidToc (the table of contents did not parse), kInvalidStream, kUnsupported (legal AC-4 this decoder does not read; Decoder::refusal_reason() names it) and kMissingIFrame (a frame that needs configuration no I-frame has sent yet), and the inspector's iclforge::ac4::Error has three (kTruncated, kLostSync, kUnsupportedBitstreamVersion).

By default a frame that fails produces no audio and the caller decides what to do. All three decoders take a concealment policy (DecoderConfig::concealment; conceal=repeat|mute|off on forge decode and monitor, off by default) that returns a frame's worth of audio instead of the error, repeating the last good block with a fade or playing silence, so a stream with a damaged frame stays continuous. A frame that fails before any frame has decoded has nothing to conceal from and still returns its error.

A refusal is not a rollback, though. The decoder's own state — overlap-add delay, the §7.3.4 dither generator, JOC reconstruction — advances block by block as the frame is parsed, and a frame refused part-way through has already advanced it as far as it got. On an _into form the caller's spans are left in an unspecified state for the same reason. Neither is a memory-safety problem (nothing is read or written outside its own buffer), but a caller that needs a clean state after an error should construct a fresh decoder rather than continue with the one that refused.

CRC is checked, on both generations: AC-3 checks crc1 over the first 5/8 of the frame and crc2 over the whole of it, E-AC-3 checks its single CRC over everything past the sync word. kBadCrc is a real refusal, not a warning.

AC-4 differs. A sync frame with the sync word 0xAC41 carries a CRC-16 (Annex G), and iclforge::ac4::scan and iclforge::ac4::SyncFrameSplitter compute it and report the result per frame (SyncFrame::crc_ok; forge probe counts the failures), but neither they nor iclforge::ac4::Decoder refuse a frame for a bad CRC. A frame with one still reaches the decoder's syntax layer, which is why fuzz_ac4_decode needs no CRC-repairing mutator. A caller that wants AC-3's behaviour checks crc_ok itself.

Reporting an issue

Use GitHub Security Advisories, privately — the process and timelines are in SECURITY.md.

If you found it while embedding this library, the two things that speed up a fix most are:

  1. The input. A stream, WAV or ADM file that reproduces it, however small. If it came out of a fuzzer, the raw corpus file is ideal — it drops straight into fuzz/regressions/<harness>/ as a permanent regression case.
  2. Which entry point you called, and whether you were using an allocating decode form or an _into form with your own spans. Those have different contracts and a report that does not say which one is in play can take a while to place.

A sanitizer report (ASan/UBSan stack) is worth more than a description of the symptom, and the build that produced it (forge --version prints version, commit and toolchain) says whether what you hit is already fixed.

See also

  • Validation — how output correctness is checked, and where the oracles run out
  • Conformance vectors — the published stream set, and what it does and does not prove
  • tools/fuzz/README.md — the harnesses, the differential oracle and its agreement floor
  • Decoding — the decode API this page describes the boundaries of
  • C API — the ownership and error conventions in full