bullet3-0001: btGhostObject::addOverlappingObjectInternal O(N²) linear dedup per broadphase step — even carries "too slow" self-admission comment (HIGH) bullet3-0002: btSoftRigidCollisionAlgorithm::processCollision O(C×D) per frame on m_collisionDisabledObjects plain array (MEDIUM) allegro5: CLEAN (vector_contains only on non-hot setup paths) box2d: CLEAN (v3 rewrite uses b2HashSet throughout) dry: CLEAN (HashSet/HashMap on all hot dedup paths)
1.2 KiB
1.2 KiB
CLEAN — Dragonfly (Redis-compatible, C++)
Scanned 2026-03-29 for CWE-407 (algorithmic complexity: O(N²) linear membership tests, O(2^D) diamond recursion).
Scope
src/server/— key eviction, cluster family, stream family, replicationsrc/core/search/— HNSW vector search, range treesrc/server/search/— document index, aggregator, search family
Findings
- HNSW vector search (
src/core/search/hnsw_alg.h) — usesVisitedListPoolwith a flat array indexed by element ID (visited_array[id] == tag). O(1) per visited check. CLEAN. - Aggregator dedup (
src/server/search/aggregator.cc) — usesabsl::flat_hash_set<Value>for DISTINCT counting. CLEAN. search_family.cckIgnoredOptions —std::findonkIgnoredOptions/kIgnoredOptionsWithArgwhich are compile-time constant arrays of ~5 strings. O(1) in practice. CLEAN.doc_index.ccfree_ids_ — DCHECK-only assertion, not a production hot path. CLEAN.- Cluster / replication — no vector-based membership checks found in hot paths; uses hash maps throughout.
Result: No actionable CWE-407 defects. Dragonfly consistently uses absl::flat_hash_set, flat_hash_map, and array-indexed visited tracking.