1.6 KiB
1.6 KiB
UNDF: UNDF-2026-000000578
Zig CWE-407 Scan — CLEAN
Date
2026-03-27
Scope
src/Sema.zig— semantic analysis, type inference, comptime evaluationsrc/InternPool.zig— type/value interningsrc/Zcu.zig,src/Zcu/PerThread.zig— compilation unit managementsrc/Air/Liveness.zig— liveness analysissrc/link/Elf.zig,src/link/Elf/— ELF linkersrc/link/MachO.zig,src/link/Elf/synthetic_sections.zigsrc/codegen/x86_64/CodeGen.zig,src/codegen/llvm.zig
Findings
No CWE-407 defects found. Zig's compiler is well-designed with O(1) data structures throughout all hot paths:
- Error set membership:
InternPool.ErrorSetType.nameIndexuses a hash map (names_map) — O(1) lookup. - Error set merge:
errorSetMergebuilds viaInferredErrorSet.NameMap(hash map) — O(N). - Liveness analysis:
live_setisAutoHashMapUnmanaged— O(1) operations. - Switch dedup:
seen_errorsisAutoHashMap— O(1) operations. - GOT/PLT entries: Indexed via
symbol.flags.has_got/symbol.addExtra— O(1). - Rpath dedup:
rpath_tableis a hash map — O(1). - Analysis tracking:
outdated,failed_analysis,analysis_in_progressare allAutoHashMapUnmanagedorAutoArrayHashMap— O(1) contains checks.
The one instance of std.mem.indexOfScalar found (src/InternPool.zig:1890) is a
null-check for underscore characters in strings — not a membership test in a hot loop.
Conclusion
Zig CLEAN for CWE-407. The language team has consistently chosen hash-based data structures for all compiler-internal membership tracking.