open-standards/wai/quantum-conformance/formats/jeff
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Transaction Science cb059d7a0b wai-quantum: other formats bounded against hostile input, in CI
A jeff register's size reached Vec::with_capacity before the qubit cap,
so one of 2^32 - 1 qubits asked for 34 GB: under wasm32-wasip2 the test
written first trapped in qureg_op. It is now refused (Q111) before
anything is made. The audit of every allocation and loop sized by the
input:

- the wire reader bounds every pointer, segment and list in 64 bits (a
  segment count of u32::MAX overflowed a 32-bit usize), and counts each
  list element against the words it may visit;
- the jeff reader counts every register slot, array element (an array
  copied by setIndex included), call frame and condition term against
  one budget, caps arrays, values per function, operations run and gates
  written, shares conditions between copies, and no longer truncates a
  64-bit size, index, selector or shift to fit;
- the QIR reader no longer copies a block's lines on each visit, bounds
  the nesting of branches, the instructions run over every path and the
  state each path copies, and dedups a condition's reads;
- a condition is at most 1 024 terms and 32 deep once written, a run of
  one operator written flat;
- a conversion's check is not run past 262 144 gates applied or 4e9
  amplitudes, and says so; both readers take modules of up to 16 MiB.

tests/formats_mutation.rs mutates every QIR and jeff file of the
conformance set from a fixed seed (45 153 inputs: bits flipped, files cut
short and spliced, every length, count, offset and 32-bit field inflated)
and holds each to converting or a refusal with a code of the table,
within 20 s and 1 GiB measured by a counting allocator.
wai-quantum-formats.yml runs it natively and under wasm32-wasip2 (a
release build with overflow checks), the count pinned.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 07:16:32 -04:00
..
refuse wai-quantum: other formats bounded against hostile input, in CI 2026-10-31 07:16:32 -04:00
upstream quantum-conformance: other formats, natively and under wasm32-wasip2 2026-10-31 07:16:32 -04:00
controls_after_targets.jeff quantum-conformance: other formats, natively and under wasm32-wasip2 2026-10-31 07:16:32 -04:00
controls_after_targets.ref.qasm quantum-conformance: other formats, natively and under wasm32-wasip2 2026-10-31 07:16:32 -04:00
custom_named.jeff quantum-conformance: other formats, natively and under wasm32-wasip2 2026-10-31 07:16:32 -04:00
custom_named.ref.qasm quantum-conformance: other formats, natively and under wasm32-wasip2 2026-10-31 07:16:32 -04:00
pauli_product.jeff quantum-conformance: other formats, natively and under wasm32-wasip2 2026-10-31 07:16:32 -04:00
pauli_product.ref.qasm quantum-conformance: other formats, natively and under wasm32-wasip2 2026-10-31 07:16:32 -04:00