java-topology/defects/minivmac/scan
russell@unturf.com 64c65b567d gearboy+gearsystem: 2 CWE-407 defects (breakpoint O(B) scan per memory access); minivmac all 5 MOADs CLEAN
gearboy-0001: Processor::CheckBreakpoints() and CheckMemoryBreakpoints() scan
m_breakpoints std::vector O(B) on every opcode dispatch and every memory
Read/Write. At ~4 MHz with B=64 breakpoints: ~256M comparisons/second.
Fix: std::unordered_set<u16> index for O(1) point-breakpoint lookup.
8.4x speedup measured in Java model.

gearsystem-0001: Same defect in GearSystem (SMS/GG emulator). Compounded by
Video.cpp calling CheckMemoryBreakpoints() on every VDP VRAM/CRAM access
(5 additional call sites beyond CPU). >5M O(B) scans/second at 3.58 MHz.
7.1x speedup measured in Java model.

minivmac: All 5 MOADs CLEAN. LocalFindATTel() bounded to 16-20 ATT entries
by design (constant, not O(N^2)). Single-threaded, no credentials, no TLS.
2026-03-31 19:55:45 -04:00

31 lines
1.4 KiB
Text

CLEAN
MOAD-0001 (CWE-407): CLEAN
- Mini vMac is a C codebase with no C++ STL containers. No std::find,
std::vector::contains, or list membership checks in hot emulation loops.
- LocalFindATTel() is a move-to-front linked list search called on each
memory access, but the list (ATTListA) is bounded to MaxATTListN=16-20
entries representing fixed Mac hardware regions (ROM, RAM, hardware I/O).
The O(N) cost is constant-bounded, not O(N^2), and the move-to-front
heuristic makes the common case O(1) after warm-up.
- M68KITAB.c builds a 65536-entry dispatch table at startup -- O(N) once,
not O(N^2) in the hot path.
MOAD-0002 (Intertangle): CLEAN
- GLOBGLUE.c/.h uses global state by design (V_regs, ATTListA, etc.).
This is intentional for a minimal single-Mac emulator, not accidental
god-object coupling. All modules have well-defined responsibilities.
MOAD-0003 (Leaked Context): CLEAN
- Single-threaded emulator. No pthread_key, thread_local, or TLS usage
anywhere in the codebase.
MOAD-0004 (CWE-312): CLEAN
- Mini vMac is a pure hardware emulator. No network authentication,
credentials, passwords, tokens, or secrets are processed or logged.
The only external auth reference is struct passwd in OSGLUXWN.c for
Unix home directory resolution -- not logged.
MOAD-0005 (Thundering Herd): CLEAN
- Single-threaded, deterministic emulation loop. No concurrent cache
access or unsynchronized lazy-init patterns.