Repository navigation
Crafted files: eighteen readers do unbounded work or hold unbounded memory, two of them exponential #1833
Copy link
Copy link
Closed
Labels
area:readerWork in the reader area.priority:P2Important quality, usability, or hardening work.type:securitySecurity, supply-chain, privacy, or network-safety work.
Description
What
Eighteen places where a crafted file can make a reader do work, or hold memory, that grows faster than the file, with no budget. None panics; each is a hang or an out-of-memory on a hostile file. Each was found by an audit of the parsing paths and confirmed by a second reader. rvtDevelop re-read the two exponential ones (A, B) against main (1a9aacc7). #1831 has the panics from the same audit.
Exponential
- A.
src/research/native_index.rs:357-421,fixed_layout: the only bound isdepth < 128. A chain of classes, each holding two reference fields (base == 14) to the next, makes 2^127 visits, with or without leaves. Every native read reaches it (native_preamble). - B.
src/research/native_graphics_traversal.rs:544,only_curves:seenholds only the current path, and nothing counts calls. A duplicated or shared child at each level makes up to 2^128 calls.visitstops at 100,000, but this check never counts against that. Default export (saved graphics) and the viewer.
Polynomial in a file-sized count, on the default export path
- C.
src/research/partition_pipe_axes.rs:413-415,scan_pipe_end_keys: acontainson an uncapped keyVec, O(H²) in connector markers. - D.
partition_pipe_axes.rs:223-241,BoxGrid::new: 4,096 cells per pipe box, no cap on the total over boxes. - E.
partition_pipe_axes.rs:307-315,connector_points:holdsruns before the 64-point cap, H × boxes per cell. - F.
src/research/partition_curve_fields.rs:243-246: each anchor's 2 KB window is not clamped to the next anchor, and oversized boxes are tested at every point, anchors × boxes. - G.
src/research/partition_room_parameters.rs:337-354,enclosing_data_object: a 200,000-step backward search for every parameter-key hit (:462,:518), hits uncapped, about 4e12 steps in 256 MiB. - H.
src/research/partition_room_boundaries.rs:877-890,solid_headers_by_id: headers per id uncapped, and each rescans 64 KiB. - I.
src/research/element_record_plan_profiles.rs:820-888,solve_loops/sole_candidate: Θ(n⁴) to Θ(n⁵) in one owner's sketch lines, with no cap per owner. - J.
src/research/element_record_wall_joins.rs:286,join_trims: quadratic in wall records (each candidate scan up to 1,024 references), no cap on records. - K.
src/research/native_empty_faces.rs:122, fromnative_saved_mesh.rs:2086: every matchingEdgerescans every object of the graph. That is about 1e12 per face at the export's 1,000,000-object graph limit. - L.
src/reader.rs:900, the inflated-partition memo: 1 GiB per stream, nothing over the sum ofPartitions/*streams. - M.
src/reader.rs:980,header_hits: oneusizeper header hit, kept for each (stream, header), about 0.8x the stream.
Opt-in paths
- N.
src/research/native_parameter_definitions.rs:310-327,matching_bindings: bindings × backlink array for eachFamilyInstance/FamilySymbolrecord (--revit-property-sets,rvt-elements). - O.
native_parameter_definitions.rs:379,ingest_units:UnitsElemrecords × definitions. - P.
src/research/native_family_forms.rs:278-286,blocks_of: bodies × content keys, with no cancellation check inside (--family-extrusions). - Q.
src/research/native_form_geometry.rs:1696,surface_samples: allocated outside theMESH_PAIR_BUDGETcheck, about 39 × 2e6 points plus 512 per solid (--family-extrusions).
Research API only
- R.
src/research/partition_scanner.rs:178,max_candidates: Noneby default: one candidate per 4 bytes for a schema tag repeated through a partition.
Done when
- Each is bounded by a budget stated with its reason, or a structure that removes the blow-up (a memo, a sorted set), at no cost to a real file.
- What a hostile input gets over a budget is stated: refused with a note, or the element is drawn without that part.
- Every export of a real file is byte for byte as before: an unfiltered Measure for each PR.
Found by Tendrils audit workers (DeepSeek), and checked by a second worker each.
Metadata
Metadata
Assignees
Labels
area:readerWork in the reader area.priority:P2Important quality, usability, or hardening work.type:securitySecurity, supply-chain, privacy, or network-safety work.
Activity
wip: the mesh comparison makes only the surface samples it strides to (…
wip: each partition scan takes the candidate cap's remainder (#1833 R)
wip: each category's parameter bindings matched once, when the defini…
fix(reader): the inflated-partition memo is held under 16 GiB, and pa…
fix(research): names already in scope go unqualified for the MSRV lin…
feat(ifc): a reader that stops at its work budget says so in the expo…
docs(changelog): rewrap the #1833 fragment under 80 columns
docs(changelog): reflow the #1833 fragment's last lines
fix(research): an element index row's layout and a graphics branch's …
style(research): the three lints clippy stopped #1849's lib build on (#…
fix(research): a data object's checksum is read from sums kept along …
feat(ifc): work-budget stops are kept with the file, and the CLIs, Py…
fix(research): MEP systems and curtain materials take their objects f…
fix(ifc): type objects, hosted cuts, piece sets, wall joins, family b…
fix(research): pipe connectors, curve fields, room parameters and sol…
6 remaining items
DrunkOnJava commentedon Nov 14, 2026
Where the eighteen stand on
main(2b4f18b):Each of the three PRs left every export of its unfiltered Measure byte for byte as before, and #1849 reports a reader's budget stop as
work_budget_reachedin the diagnostics:rvt-ifcandrvt-gltfexit 3, and Python raises, unless the caller allows a partial export.Left: R's default.
ScanOptions::default()still setsmax_candidates: None. That one is not like the others:scan_partition_bufferreads each offset once and keeps at most one candidate for every four bytes (a candidate needs its tag and two zero bytes), so its time and memory grow linearly with the stream, under the reader's stream limit, rather than faster than the file. It is a research API (rvt::research::partition_scanner), and nothing in the export or the CLIs calls it: onlyexamples/partition_scanner_json.rsand two corpus tests do. A default cap would need the candidate totals of real files first, so that it never cuts a real scan; #1849's challenger asked for those. That measurement is what keeps this open.fix(research): the partition scanner stops at 16,777,216 candidates b…
test(research): a real-file check that a capped partition scan keeps …
fix(research): the partition scanner stops at 16,777,216 candidates b…
chore(release): prepare v0.25.0 (#2067)