Skip to content

Binary formats: comparison and Flat design delta ​

The strongest precedent for Flat is a checked view over a restricted layout, with an independently specified arena producer. The survey supports keeping foreign-format descriptions and owned arenas in one vocabulary, but not giving them the same acceptance, canonicalization or evolution policy. It also contradicts two tempting shortcuts: repeatable builder calls are not a canonical value encoding, and an input-derived cache key does not authenticate the resulting file.

Last reviewed: October 17, 2026

NOTE

This is a research recommendation, not an amendment to the specification. Every WFL reference describes the draft at the pinned revision. Its plan marks implementation as planned; the proposed compile-time proof and code-generation tests are not evidence of delivered behaviour. The first consumer is the font startup slice.

At a glance ​

FamilyRepresentative systemsMost useful lesson for FlatWhat not to inherit accidentally
Existing-byte descriptionsKaitai, DFDL, ConstructMake bases, counts, context and variant selection explicitGeneral interpreters, arbitrary seeks and unbudgeted computation
Verified accessor layoutsFlatBuffers, Cap'n ProtoSeparate opening, structural verification and access costsAssuming a verifier authenticates input or validates domain semantics
Fixed block with tailsSBE, SSZ, BebopDistinguish fixed-stride access from sequential variable dataCalling every nested variable list random-access
Evolvable object protocolsprotobuf, Thrift, Avro, CDRCompatibility needs identity, framing, presence and skip rulesTreating a layout fingerprint as a migration system
Generic value encodingsMessagePack, CBOR, BSON, Smile, UBJSONExplicit type grammars still need semantic and resource policyEquating self-description with canonical or safe decoding
Canonical and signed profilesDER, COSE/dCBOR, TUF/in-totoState exactly which representations and bytes signatures coverNormalizing signed bytes before verifying their signature
Typed/content-addressed structuresSSZ, IPLD, Plutus, GitDistinguish schema, typed value and encoded-object identityCalling every datum digest a Merkle root
Verified distribution and logsBao, BitTorrent v2, CT, CometBFT, HypercoreChoose tree shape for the access and trust problemAdding append-only log machinery to an immutable cache

1. In-place access and bounded validation ​

Keep checked lazy access and make eager validation's work contract more explicit. There is no universal “zero-copy verifier” algorithm to copy.

SystemOpening and accessHow work is boundedConsequence for validateFlat
FlatBuffersRoot/table/vector access without object materialization; unchecked access requires a successful verifier or trusted producerVerifier checks ranges/alignment and has nesting/table limits; details and defaults are implementation-specificTest node count and depth, not just buffer length; verify the chosen generated API's preconditions
Cap'n ProtoSegment/pointer readers check as objects are reached; packed transport must first be unpackedTraversal size charged on dereference, nesting bound, special handling of zero-size structuresRepeated aliases must cost work; bytes physically present do not bound the expanded graph
SBEFixed fields at generated offsets; groups and variable data traverse in schema orderFrame bounds and application/codec checks; no universal recursive whole-message verifierCheap flyweights are not evidence that hostile frames are safe without framing and limits
SSZFixed fields are located by type; offsets delimit variable partsSchema maximum lengths, monotone and valid offsets, exact extents; implementations supply resource budgetsType bounds and strict extent checks complement, rather than replace, work accounting

WFL11–WFL17 and WFL23 correctly keep bounds safety independent of eager validation. WFL24 correctly charges repeated visits and at least one byte for zero-size elements. Depth-first offset traversal with a budget rejects cycles without requiring an allocating visited set. A visited-set optimization would change costs and semantics: the key must include the target type, parameters, offset base and any contextual rules, not just its address.

Narrow WFL23's validation-success postcondition to applicable accesses with valid caller selections and operation-specific eligibility. As written, its sole exception is indexOutOfRange, while WFL55 requires get!R to return unknownVariant when the caller asks for a different variant. Structural validation also does not automatically establish the actual address alignment needed by native. Separate structural validity, semantic/UTF-8 checks and native-reference eligibility rather than promising that every operation on a validated root becomes infallible.

The reference probes recorded FlatBuffers defaults of nesting 64, 1,000,000 table visits and enabled alignment checks; a generated empty Monster passed normally and failed with max_tables = 0. Table visits are not a count of every scalar vector element. The Cap'n Proto probe recorded 8,388,608 traversal words (67,108,864 bytes) and nesting 64; that probe observed defaults, not enforcement against an adversarial graph. These measurements establish concrete implementation policy, not interchangeable accounting units or benchmark results.

Retain the provisional depth of 64 and HarfBuzz-inspired budget only as initial policy to measure, not as a derived security constant. The draft's O7 already requires real-font measurements. Neither FlatBuffers nor Cap'n Proto establishes that “64 times file length” accepts the right Flat inputs; their accounting units and grammars differ.

Add a precise accounting specification and adversarial tests:

  • Define whether charging a record's complete extent and then its contained members deliberately charges their bytes twice. Either can be bounded; they produce different thresholds on valid deeply nested data.
  • Charge loops over counts, offset aliases, UTF-8 bytes and attempts to produce accumulated errors. Bound caller-supplied error sinks separately if the sink can retain or render every error.
  • Check the remaining budget before work or arithmetic whose cost it bounds. A rejected charge must not overflow. Include depth through inline nesting where schema-generated code can recurse, not only runtime offset following.
  • Specify the extent-discovery cost. Finding a later dynamic member after a sequential, variable-extent array requires visiting earlier elements unless an index or total byte length exists. WFL14's no-other-data-loop rule and WFL31's back-to-back members need a worked trace for this case; the SBE and SSZ layouts expose this trade-off instead of erasing it.
  • State a separate precondition on user-supplied count, selector and @WireCheck functions: declared D attributes do not prove bounded running time. A pure nothrow @nogc loop can still run forever. Callback work needs a documented restriction or explicit accounting hook.

Runnable sequential-tail counterexample ​

This independent framing probe is not a Flat implementation. It models a one-byte count followed by that many one-byte-length-prefixed records, then a tail. Knowing only the count and the fixed header cannot locate the tail: the reader must inspect both length prefixes. This is the same structural issue that SBE's sequential groups make explicit. An enclosing byte length or offset index would change the answer.

d
#!/usr/bin/env dub
/+ dub.sdl:
    name "binary_formats_sequential_tail"
    buildType "checked" {
        buildOptions "optimize" "inline" "debugInfo"
    }
+/

import std.stdio : writeln;

void main() @safe
{
    immutable ubyte[] bytes = [2, 1, 'a', 2, 'b', 'c', 255];
    size_t at = 1;
    size_t inspected = 0;
    foreach (i; 0 .. bytes[0])
    {
        if (at >= bytes.length)
        {
            writeln("truncated prefix");
            return;
        }
        const length = bytes[at++];
        ++inspected;
        if (length > bytes.length - at)
        {
            writeln("truncated element");
            return;
        }
        at += length;
    }
    if (at >= bytes.length)
    {
        writeln("truncated tail");
        return;
    }
    writeln("tail offset: ", at);
    writeln("length prefixes inspected: ", inspected);
    writeln("tail byte: ", bytes[at]);
}
tail offset: 6
length prefixes inspected: 2
tail byte: 255

An attainable complexity claim is O(charged visits + checked bytes + bounded schema/check work), with an explicit stack bound and no hidden memoization. Distinguish two claims. An acceptance-or-rejection attempt can be bounded by a file-size-derived work budget alone: it may return limitExceeded on a structurally valid but expensive graph. Completing validation of every valid alias graph in O(file length) is stronger and may require memoizing contextual states within caller-owned bounded storage. The budget does not establish that stronger acceptance guarantee. Record maximum budget use and depth over real fonts, then test zero-stride arrays, alias fans, cycles, long strings and truncations at every boundary. Those are validation gates, not benchmark claims.

2. Relative offsets and foreign layouts ​

One description mechanism is reasonable; one wire convention is not. The critical capability is expressing the right base and context, not merely having a 16- or 32-bit integer called an offset.

SystemOffset/tail mechanismOpenType-style description?
KaitaiPositioned instances, substreams, expressions, parent/root context and type switchesYes, with explicit seek bases and sibling-count expressions; generated object parsing is a separate access model
DFDLLength/occurrence/alignment properties, expressions and choice discrimination over an existing representationMany structured layouts; arbitrary pointer-graph traversal is not its general wire model
ConstructContext expressions, Pointer, counted arrays, Switch, Tell and bounded substreamsYes for explicit base arithmetic and contextual counts; Python objects are not native mapped views
FlatBuffersOwn field-relative offsets, signed table-to-vtable displacement, vectorsNo general declaration of arbitrary OpenType bytes; converting to FlatBuffers changes the format
Cap'n ProtoOwn word-relative pointers, segments and far-pointer landing padsNo general description of packed big-endian foreign records
SSZEnclosing-value-relative 32-bit offsets in a fixed section, serialized variable parts in orderIts own encoding, not arbitrary parent-relative pointer graphs

WFL29–WFL40 address the right foreign-format requirements: sibling counts, parameters inherited from a parent, ancestor-relative bases, format tags and version-dependent tails. WFL42 is valuable precisely because a real ItemVariationData is harder than a toy length-prefixed list. Keep its independent oracle gate. The font parser contract also establishes why a region may be a table slice rather than the complete font.

Use two profiles of the shared layout vocabulary:

  1. Foreign reader: explicit byte order and packed fields, external conventions for null offsets and padding, possible sharing/cycles, and format-specific checks. Never require producer canonicality to read a legitimate foreign file.
  2. Owned arena: restricted alignment and offset widths, zeroed padding, specified traversal and allocation policy, versioned root/header, and a deterministic producer. Canonicality or acyclicity can be stronger here without making the foreign reader less useful.

The proposed builder rejects targets before the declared offset base and distances exceeding the offset width (WFL48). This does not prohibit every allocation-order backward link: a region- or ancestor-relative offset can name an earlier record while remaining nonnegative. Equality with the base is not generally excluded either. Do not infer acyclicity from unsigned offsets. Foreign readers follow any target permitted by their region and description (WFL36); the builder is deliberately narrower, not a general inverse of every foreign description. Arena examples should establish that its base and width restrictions permit the intended sharing pattern.

3. Host-language schema versus IDL ​

Keep D declarations and wireSchemaOf, but demand a portable artifact from them. The choice is not “reflection or code generation”: compile-time introspection itself generates specialized code.

ApproachGainsCosts / evidence
D layout proof + attributesOne declaration, compiler-enforced field types, shared schema node identitiesNative aliases and ABI rules can leak target dependence; arbitrary functions cannot be fingerprinted by their spelling alone; Flat WFL2, WFL8, WFL41
Python combinatorsContext-sensitive counts and selection can be ordinary codeInterpreter/object overhead and weaker portable layout proof; Construct
Rust derivation and layout traitsCompiler-checked conversion properties, type-directed borrowingA valid byte pattern, initialized output bytes, alignment and immutability are distinct obligations; zerocopy 0.8.63
Separate IDL + generatorLanguage-neutral schema, shared evolution rules, generated documentationGenerator/runtime version agreement, a second tool and build phase; SBE, protobuf, FlatBuffers
Reified schema shared by toolsOne structural artifact drives emitters and diagnosticsThe artifact must retain the facts consumers need; serde's tier analysis

Zerocopy explicitly separates FromBytes (“Types for which any bit pattern is valid”) from TryFromBytes (“Types for which some bit patterns are valid”), and separates both from IntoBytes, KnownLayout, Immutable and Unaligned (official API). That supports WFL7's conservative native-reference eligibility and WFL3's explicit pads; a single “POD” flag would collapse different proofs.

Generation is not itself a safety property. Construct's compilation guide warns that omitted checks make its compiled parsers unsuitable for untrusted input. For Flat, compile-time layout admission and runtime bounds/work enforcement therefore need independent evidence; a generated accessor is not safe merely because its description compiled.

Retain the O10 spike's ordinal schema walk, but cover offset targets, recursive type graphs, selectors and parameters before declaring the shared schema integration complete. The draft itself says the spike did not cover those. Export a stable layout manifest and golden bytes for non-D tools even if an independent IDL is not introduced. That gives a reviewer something to compare across targets without reverse-engineering template diagnostics.

4. Evolution and cache rebuilds ​

“Rebuild, never migrate” is sound for disposable, reproducible caches, not as a universal file-format evolution strategy. It requires the producer's inputs and tool version to remain available, and a useful failure path on the device. Font MS supplies a real cache consumer; WFL44 and WFL54 should remain explicit about that scope.

StrategySurveyed evidenceWhat Flat would need for durable files
Stable field numbers, skippable unknown fieldsprotobuf, Thrift, Bebop messagesField framing and unknown-field policy, stable IDs, reserved removals
Writer/reader schema resolutionAvroWriter schema identity and availability, resolution/default rules
Missing slots/defaults, stable ordinalsFlatBuffers, Cap'n ProtoPresence and default semantics, append-only field rules, compatibility tests
Version + block length / extensibility modeSBE, CDR/XCDR2Acting version/extent, stable offsets for old fields, skip boundaries
Exact layout rejectionFlat draftNo migration machinery for caches; deterministic rebuild and explicit stale-file rejection

Keep pins and golden files. A pin history prevents an accidental unchanged version when its computed digest changes; it cannot prevent someone editing both the digest and the last pin, nor catch a semantic change excluded from the digest. WFL41 excludes @WireCheck, and names callback rules by shape and the positions they reference, not an executable semantic proof. A change to a function's body may change interpretation without changing field layout.

Therefore distinguish layout version, semantic format/producer version and build-input identity. Include relevant producer, rasterizer and configuration versions in the cache key; enforce semantic changes by review and golden fixtures. A 64-bit FNV-1a layout digest is an accidental mismatch guard, not a hostile schema identifier. Leave its role narrow rather than claiming it authenticates compatibility.

Supporting durable Flat files later requires a separately specified profile: major/minor rules, old/new reader matrix, field or section extents, unknown variant policy, stable defaults, and a way to locate the writer's schema. Adding a version integer alone supplies none of those. Defer that profile until a non-cache consumer exists, as O8 proposes.

5. Determinism, canonicality and hashing ​

Hash bytes for byte integrity; define value equivalence before claiming value identity. The first arena does not need a canonical value encoding to be a useful deterministic cache.

ContractSystemsLesson
One encoding for a specified type/profileDER, SSZ, DAG-CBORType/profile identity is part of the agreement
Deterministic profile with additional application choicesCBOR §4.2, dCBOR, canonical JSON for metadataNumeric equivalence, strings, keys and duplicate handling must be explicit
Deterministic serialization, not canonicalprotobuf, FlatBuffers builderStable output from one producer is weaker than cross-producer normalization
Signature over an exact representationCOSE, DSSEVerify the specified signed bytes/envelope, not a convenient re-encoding
Exact encoded block/blob identityGit, IPLD, Bao, BitTorrentDifferent bytes can correctly have different identities

WFL49 promises identical bytes for the same builder call sequence and arguments. Two call sequences that reserve objects in different orders can describe the same logical records at different offsets and still satisfy it. Zeroed gaps prevent uninitialized data leakage; they do not choose an object order, sharing policy, string normalization, float equivalence or unused-tail policy. WFL18 preserves floating-point bit patterns, including NaN payloads; that is a defensible byte-preservation policy, not semantic NaN normalization.

Canonicality claims also need revision-specific differential fixtures. The SSZ survey records historical/new-reference differences in progressive tree orientation, selector padding and inactive-field positions. The dCBOR survey records a draft-vector/Rust-implementation disagreement at the negative-integer boundary. A named profile and plausible round trips are not enough to establish that two chosen implementations agree.

  • Keep WFL43.contentKey opaque and call it a build-input key. Specify the consumer's framed input-key recipe: domain/version, font bytes or hashes, rasterizer/version, face/instance, exact rational ppem and all output-affecting configuration. The startup plan already names much of that state.
  • If corrupted or untrusted cache bytes must be detected, add an encoding digest in a separate integrity layer or manifest. State whether it covers the whole file, how a digest field is excluded/zeroed if embedded, and how the expected digest becomes trusted. A checksum supplied by the same attacker as the bytes is not authentication.
  • If logical-value deduplication is needed, define a canonical arena profile: object traversal/allocation order, alias and duplicate policy, padding, strings, numeric bit patterns, unreachable bytes and header fields. Require strict acceptance or canonical re-encoding only in that profile.
  • If a future root is typed like SSZ, give it a distinct domain and API. It must not silently replace a whole-file BLAKE3 digest or an input cache key.

The content-addressing catalog already records why cache keys and content addresses differ. That distinction is more important here than choosing between cryptographic hash algorithms.

6. Merkleization and partial verification ​

For immutable mapped atlases, prefer an external byte-range verification layer before redesigning the arena as a typed Merkle graph. The problem is to verify requested byte ranges; it is not necessarily to prove application field membership or append-only history.

ConstructionShape and domain rulesBest use / mismatch
RFC 6962 / CTOrdered leaves, split at the largest power of two below the size; 0x00 leaf / 0x01 node prefixesInclusion and append-only consistency; useful log semantics, excess machinery for a static atlas
CometBFT simple treeRFC 6962-style leaf/node separation and ordered recursive splitConsensus commitments; protobuf serialization rules remain separately relevant
SSZTyped 32-byte chunks, padded capacity, length/selector mixing where defined; progressive rules are revision-sensitiveField/element proofs under a known type; schema bounds affect roots
Bao/BLAKE3Byte chunks under BLAKE3 flags, counters and root rules; outboards and grouped transferVerified ranges without changing the application file layout
BitTorrent v2Per-file SHA-256 binary trees with 16 KiB block leaves and specified padding/piece layersDistribution-sized pieces and independently identified files
HypercoreFlat-tree addressing, leaf/parent commitments and signed tree metadataAppend/truncate/replication protocol, not simply immutable-file hashing
IPLDCodec-defined blocks linked by CIDs; CID includes codec and multihash informationObject-level dedup and graph retrieval; needs a block/layout boundary policy
GitTyped objects whose encodings carry child IDsWhole-object verification; no intrinsic byte-range proof within one blob
Plutus DataLedger encoding and datum hashA datum hash alone supplies no child proof API or chunk tree

The repeated rule is commit to unambiguous structure, lengths and domains, not “all systems use the same binary tree.” Padding, empty-tree rules and length mixing differ. Proofs cannot be transplanted by reusing only a node hash function or array-index convention.

For a later Flat experiment, choose between two falsifiable options:

  1. Byte-range outboard: keep the arena unchanged; publish a trusted BLAKE3 root plus the compatible outboard/length metadata. Verify complete required chunks before exposing a requested range. Bind the header and offsets too: an authenticated pixel block with an unauthenticated offset table is not a verified lookup. Measure proof size, verified-byte amplification and latency against a full-file hash.
  2. Typed arena DAG: identify immutable records/blocks and commit to their type/version, lengths and child identities. Define whether equal values share a node and how offsets map to authenticated blocks. Compare proof cost and random-access locality with the outboard approach before adoption.

Neither makes a bare mmap fault authenticate pages. Verification must actually mediate exposure, or the byte source must supply an independently enforced integrity mechanism. Keep this out of the initial Flat reader and builder; Bao and the existing intra-file survey supply the closest prior art without duplicating a new hashing protocol.

7. Byte order and alignment ​

The evidence supports naturally aligned native references plus unaligned, byte-order-aware accessors. It does not prove four bytes is a universal format ceiling.

FormatByte orderAlignment policy
FlatBuffersLittle-endianScalars aligned within its buffer; actual buffer-base alignment remains a caller obligation
Cap'n ProtoLittle-endianWord-oriented, normally 8-byte-aligned representation; packed transport is distinct
SBESchema-selected orderSchema offsets/block layout; generated access primitives handle representation rather than relying on native struct layout
CDR / XCDR2Representation selects little or big endianStream alignment and padding rules; XCDR2 changes maximum primitive alignment relative to classic CDR
SSZLittle-endian integers/offsetsSerialization itself does not promise a naturally aligned host struct
CBOR, BSONCBOR multibyte arguments use network order; BSON numeric primitives little-endianToken/document layouts are not native-reference alignment proofs
Foreign descriptionsDeclared per format or fieldPacked data can require byte assembly or legal unaligned loads

The Android zipalign documentation says ordinary uncompressed files “should be aligned to 4 bytes on both 32-bit and 64-bit systems”; the alignment is its mandatory command argument. It distinguishes shared-library page alignment (-P 16) from the ordinary 4 argument. Thus four-byte asset alignment is a defensible packaging profile, not a physical limit imposed on every possible APK or byte source. Do not generalize it into a promise about all AAsset_getBuffer results without testing the actual asset path and compression mode.

Keep WFL45 for the initial APK arena if simplicity wins: split 64-bit fields into two uint halves as the header does. Consider making the ceiling an arena profile rather than a property of all future owned files. In either case, retain WFL16's runtime address check; source alignment is not established by record-relative offsets alone. A four-byte-aligned base does not make an eight-byte field naturally aligned just because its offset is divisible by eight.

WFL52's one-load code-generation rule is a performance acceptance test on x86_64/aarch64, not a language-level safety theorem or an instruction-count promise on armv7. Keep explicit cross-target layout and generated-code probes, and retain accessor fallbacks when byte order or alignment prevents native references. Zerocopy's separate alignment and bit-validity traits reinforce that separation.

8. Hostile input: incidents and requirement coverage ​

Implementation incidents demonstrate missing checks, not that one encoding family is intrinsically unsafe. The subject pages retain the primary advisory or source evidence, affected implementation and the distinction between a reproduced probe and a documentary incident. Do not turn a single-language parser defect into a claim about all implementations.

Failure classEvidenceFlat coverage / remaining gap
ASN.1 permissiveness versus strict signed representationASN.1 BER/DER analysis and incidentsWFL11/WFL12 stop out-of-bounds/crashes, not semantic disagreement. Foreign tolerance and a strict arena profile need distinct policies
Protobuf recursive structures / stack exhaustionProtobuf safety evidenceWFL24 bounds followed offsets, but stack use through generated inline traversal and callbacks still needs proof/tests
Pointer aliases amplify a tiny buffer into much traversalCap'n Proto security model, FlatBuffers verifierRepeated charging and positive minimum charge in WFL24 are essential; byte bounds alone do not stop it
BSON length/depth/parser differentialsBSON parser safety evidenceWFL11, WFL19, WFL30, WFL24 address range/value/arithmetic/work; they do not determine unknown-field or duplicate interpretation
CBOR nested containers, lengths and inconsistent value handlingRFC 8949 security and implementation evidenceSame bounds/work requirements; a canonical arena validator needs its own acceptance rules rather than importing generic CBOR permissiveness
Token dictionary/reference state and nestingSmile, UBJSON, MessagePackFlat avoids these specific token grammars, but count/offset loops need equivalent progress and budget checks
Signed but stale or incorrectly scoped metadataTUF/in-toto, COSENone of WFL1–WFL56 is a freshness, signature-authority or rollback protocol; keep this outside the layout layer
Verified offsets followed into unauthenticated payloadsBao, IPLD, CTWFL43.contentKey supplies no byte-integrity check; add a separate trusted integrity boundary if required

Concrete incident ledger ​

These are documentary findings, not exploits reproduced by this catalog. The linked records are publisher/CNA or maintainer advisories, not secondary vulnerability summaries.

IncidentAffected path and failureRequirement mapping
OpenSSL CVE-2016-2108Before the fixes released in 1.0.2c / 1.0.1o, a large universal tag could become negative zero in d2i_ASN1_TYPE, then trigger an out-of-bounds write when re-encodedWFL19 checks restricted leaves and WFL12 forbids undefined behaviour; WFL50 round-trip success alone would not establish independent reader correctness
OpenSSL CVE-2016-2109ASN.1 BIO functions could allocate excessively from a short invalid encoding; memory-buffer functions and normal TLS parsing were not affectedAllocation-free reads (WFL22) avoid that mechanism; builder storage and validation work still need WFL47 / WFL24 limits
Protobuf Java CVE-2024-7254Nested unknown groups, discard-unknown and map/Lite paths bypassed effective recursion bounds; fixed branches include 3.25.5, 4.27.5, 4.28.2WFL24 accounting must cover every skip/variant/target path, not only ordinary record traversal
Protobuf pure Python CVE-2025-4565Recursive messages/groups could reach Python recursion failure; mitigations include 4.25.8, 5.29.5, 6.31.1nothrow and depth bounds are separate obligations; explicit limits must return limitExceeded, not rely on host stack exceptions
libbson CVE-2025-0755bson_append operations could overflow when the final document exceeded INT32_MAX; libbson before 1.27.5 affected, with separately listed server branchesWFL30 and WFL48 need checked final-size arithmetic in producer paths too, not only reads
MongoDB CVE-2026-9740BSONColumn interleaved-reference validation mutually recursed while re-entry reset depth tracking; affected branches 7.0 before .35, 8.0 before .24, 8.2 before .10, 8.3 before .3WFL24 needs one propagated validation context across nested validators; resetting limits at a target would defeat the bound
cbor2 CVE-2026-26209Before 5.9.0, deeply nested arrays in Python/C backends lacked the required data-driven depth limitWFL24 must bound data depth independently of language/runtime recursion protection
serde_cbor CVE-2019-25001Before 0.10.2, excessive nested semantic tags could overflow the stack with less than 1 KiB inputByte-size checks do not replace depth accounting; every wrapper/selector traversal needs the same bounded context
go-ipld-prime CVE-2026-35480Before 0.22.0, collection headers became uncapped map/list preallocation hints outside the allocation budgetWFL22 avoids read allocation; WFL24 must charge logical counts even when little data exists, and WFL47 must bound output reservations
go-ipld-prime CVE-2026-42328Before 0.23.0, DAG-CBOR/DAG-JSON nesting could grow a goroutine stack until fatal process terminationWFL24 needs an explicit depth/context bound; language-managed stacks are not a replacement
Cap'n Proto amplification advisories, March 2015Aliased references and additional zero-size/list cases made traversal work much larger than physical bytesWFL24 repeated charging and minimum-one charges are directly relevant; test the accounting implementation, not only the nominal limit
CometBFT ASA-2025-002Block-part acceptance needed to bind the enclosing part index to the Merkle proof index, not just accept a valid generic proofWFL28 supports within-record cross-checks, but a layout proof or byte-range digest does not establish protocol index consistency
CometBFT CVE-2025-24371Decreasing blocksync height reports could leave synchronization waiting indefinitely; fixed in 0.38.17 and 1.0.1No Flat requirement is a multi-message progress/state-machine guarantee; keep it in the surrounding protocol

The BEP reference decoder accepting 4:abc and the illustrative DSSE Python implementation counting non-ASCII payload-type characters rather than UTF-8 bytes are additional locally observed differentials, not CVE or production exploit claims. They support independent exact-byte fixtures and strict extent checks rather than treating any upstream example as an oracle for hostile-input acceptance.

Acceptance evidence Flat still needs ​

Keep the plan's every-truncation and mutation tests under sanitizers, independent reader fixtures and cross-target compilation. Extend the corpus with a primary incident's failure shape, not an unrelated exploit payload:

  • A short active path with enormous fan-out, and many aliases to one large target, distinguish depth and traversal limits.
  • A zero-extent uniform array with a huge count distinguishes iteration work from physical byte length; a zero-extent sequential element must fail to progress and be rejected.
  • Checked base + offset, count * stride, accumulated extent and diagnostic regionBase + position arithmetic must all be tested at maximum values on both 32- and 64-bit targets.
  • Bool/enum invalid bit patterns must never become native typed values before checks (WFL7, WFL19); explicit pad bytes must not expose uninitialized producer memory (WFL3, WFL26, WFL49).
  • Validation followed by mutation must remain memory-safe under WFL10; a successful validation is not a capability to bypass all later bounds checks on caller-mutable storage.

The font byte-source issue O1 is another boundary: file truncation can fault a mapping beneath D-level range checks. Atomic replacement and mapping lifetime are byte-source/publication obligations. A serialization verifier cannot solve that problem by checking the header more thoroughly.

9. Delta table against Flat ​

Keep preserves the draft's direction; change narrows or repairs an existing claim; add requests a missing contract or test; defer rejects scope growth until a consumer justifies it. These are owner-review inputs, not claims that surveyed implementations prove Flat correct.

CapabilityFlat as draftedSurvey evidenceRecommendation
Host types as descriptionWFL1–WFL6, WFL2 shared schema walkConstruct, serde, zerocopyKeep; export a portable layout manifest and test offset-target/recursive schema walks
Fixed widths, explicit pads, no hidden pointersWFL1, WFL3, WFL4, WFL53zerocopy, SBE, Cap'n ProtoKeep; distinguish readable bytes from valid native references and initialized output
Target-independent layoutWFL6, WFL8, WFL53; aliases remain a documented gapCDR, SBE own wire layouts rather than ABIKeep / add cross-target manifest goldens; avoid pretending alias provenance can be proven on one host
Declared byte orderWFL5, WFL17, WFL18CDR, SBE, FlatBuffersKeep; test both orders and bit-preserving floating-point reads
Native reference eligibilityWFL7, WFL16; alignment and all-bit-pattern validityzerocopy, Cap'n ProtoKeep conservative eligibility; accessors are not second-class copying
Cheap opening versus complete verificationWFL14, WFL15, WFL23, WFL44FlatBuffers, Cap'n ProtoKeep separation; change WFL23 to account for wrong-variant caller selections and native-alignment eligibility
Bounds and error-as-value disciplineWFL11–WFL13, WFL19–WFL22, WFL51, WFL55–WFL56Font parser, parser incidentsKeep; test diagnostic arithmetic and compact path truncation as well as data arithmetic
Eager-validation work limitsWFL24; provisional HarfBuzz-derived defaultsCap'n Proto, FlatBuffers, SSZChange / add explicit units, nested double-charge policy, callback limits and measured corpus headroom
Dynamic member lookup costWFL14, WFL31, WFL33; sequential elements supportedSBE, SSZChange cost claim or restrict/index later tails after variable sequential data
Foreign relative offsets and countsWFL29–WFL36, WFL40, WFL42Kaitai, Construct, DFDLKeep; test region containment and ancestor context explicitly
Tagged variants and conditional tailsWFL37–WFL40Kaitai, SBE, Bebop, SSZKeep strict unknown-variant errors for the declared profile; don't equate this with schema evolution
Foreign-reader / owned-writer separationWFL36 reads region targets; WFL48 rejects targets before their declared base or beyond widthForeign-layout comparisonAdd profile and inverse-law boundaries; unsigned offsets imply neither allocation-order forwardness nor acyclicity
Arena version/layout rejectionWFL41, WFL43, WFL44, WFL54Avro, SBE, protobuf show stronger evolution machineryKeep for caches; defer durable schema evolution
Layout digest versus semantic identityWFL41 omits checks and does not prove callback semanticsAvro fingerprint, typed rootsAdd semantic producer/version coverage to cache keys and review gates; keep FNV's role accidental, not adversarial
Four-byte arena alignment ceilingWFL45; halves for 64-bit valueszipalign, CDR, Cap'n ProtoKeep initial APK profile; change universal rationale to a tested deployment constraint; defer configurable profiles
Unaligned one-load accessWFL17, WFL52; selected ISAs/build typeSBE, zerocopyKeep codegen gate; do not substitute instruction shape for a language-level safety proof
Deterministic constructionWFL26, WFL48, WFL49FlatBuffers, protobufKeep same-call-sequence guarantee; add explicit statement that this is not value canonicality
Canonical arena profileNot specified by WFL49DER, CBOR, DAG-CBOR, dCBORDefer normalization until cross-producer value identity is required; zero every producer gap regardless
Build-input content keyWFL43, WFL49; opaque caller key, O2Cache versus content address, TUFChange terminology/contract to input key; add consumer-framed recipe and all producer dependencies
Output integrity/authenticationNo payload digest verification in WFL44Bao, Git, COSE, TUF/in-totoAdd separate trusted manifest/digest boundary if threat model requires it; never imply input key provides it
Partial byte verificationNo tree in WFL43–WFL49Bao, BitTorrent v2Defer; test an outboard layer before altering arena memory layout
Typed-value proofs or object DAGsNot specifiedSSZ, IPLD, Plutus distinctionDefer; need stable type/domain/block grammar and demonstrated field-level proof consumer
Append-only history, signing, freshnessOutside scopeCT, CometBFT, Hypercore, TUFDefer from Flat; root trust belongs to a surrounding protocol
Byte source, lifetime and stable mappingWFL9, WFL10; O1Font borrowing rules, zipalignKeep separate source contract; test real asset address, compression and atomic publication

Consensus standard and architectural trade-offs ​

The field's consensus is procedural rather than a single format: define wire widths and boundaries independently of host ABI; say what a reader may skip; separate structural validity from application meaning; budget hostile work; and specify exact hash/signature coverage. The field does not agree on byte order, alignment, canonical value equivalence, schema declaration style or Merkle shape. Those choices follow the consumer.

For Flat the trade-off is unusually clear. Owning the arena layout permits alignment, deterministic allocation and cheap rejection of stale caches. Describing OpenType requires packed layouts and contextual offsets the arena would not choose for itself. Share the declarative vocabulary and error model; keep profile-specific promises visible. The next design review should settle validation accounting, dynamic-tail cost and identity terminology before considering new serialization features or a Merkle format.

Sources ​