All projects with patches now have outreach docs. 276 new docs covering CWE-407, CWE-312, CWE-362 across C, C++, Java, Python, Go, Rust, C#, PHP, Ruby, JavaScript, Dart, Erlang, R, and more. Outreach gap: 276 -> 0.
2.2 KiB
FreeCAD — CWE-407 Disclosure Brief (freecad-0003)
2026-04-13 · Patch available — awaiting upstream merge
Finding
One O(W^2 * E) defect in FreeCAD's cross-section wire deduplication. Patched. Patch ready for upstream review.
The Defects
freecad-0003 (PATCHED — MEDIUM-HIGH): src/Mod/Part/App/CrossSection.cpp:78
// In removeDuplicates() — fires during cross-section computation:
auto it = std::find_if(wires_reduce.begin(), wires_reduce.end(),
[&mapOfEdges1](const TopoDS_Wire& w) {
// reconstruct edge map + compare edge-by-edge: O(E)
});
For each of W wires, std::find_if scans the accumulated wires_reduce list (up to W entries). Each comparison reconstructs and compares edge index maps costing O(E) per comparison. Total: O(W^2 * E).
Complexity Proof
At W=200 wires, E=8 edges/wire:
- Defective: 200 x 200 x 8 = 320,000 operations
- Fixed: 200 x 8 = 1,600 operations (hash on canonical edge-set key)
- 200x op reduction.
Impact
FreeCAD computes cross-sections of 3D models for 2D drawing generation. Complex assemblies with many coincident faces (bolts, screws, lattice structures) produce hundreds of wires per slice, triggering quadratic dedup.
The Fix
Key each wire by a sorted tuple of its edge TShape pointers, stored in an unordered_set:
// Before
std::find_if(wires_reduce.begin(), wires_reduce.end(), ...)
// After
std::unordered_set<vector<const TopoDS_TShape*>, VecHash> seen;
if (seen.insert(wireKey(wire)).second)
wires_reduce.push_back(wire);
Patch
Fix available: defects/freecad-0003/patch/freecad-0003-crosssection-remove-duplicates-hashset.patch
Single-file patch on src/Mod/Part/App/CrossSection.cpp. 200x speedup at W=200 wires.
What We Ask
A patch is ready for review.
- Confirm receipt and assign a GitHub issue reference (FreeCAD/FreeCAD).
- Assess severity — fires during cross-section computation; scales with wire count.
- Coordinate a disclosure date — we are targeting 90 days from first contact.
- We will credit the FreeCAD team in the public disclosure. Preferred acknowledgment format welcome.
Contact: see cover email. This brief is confidential until coordinated disclosure.