New UNDF assignments (693→720): elixir-0002 → UNDF-2026-000000698 (typespec used_type_pairs O(T²)) r-source-0002 → UNDF-2026-000000711 (.walkClassGraph match dedup O(S²)) ruby-0003 → UNDF-2026-000000712 (RubyGems dependent_gems O(N²×D)) victoria-metrics-0002 → UNDF-2026-000000717 (MetricName tag-filter O(T×I)) Total: 720 UNDF assigned
15 lines
1.1 KiB
Diff
15 lines
1.1 KiB
Diff
# UNDF: UNDF-2026-000000713
|
|
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
|
|
index abcdef00..cwe407fix 100644
|
|
--- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
|
|
+++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
|
|
@@ -464,7 +464,11 @@ trait RefChecks {
|
|
//Console.println(infoString(member) + " overrides " + infoString(other) + " in " + clazz);//DEBUG
|
|
|
|
/* Is the intersection between given two lists of overridden symbols empty? */
|
|
- def intersectionIsEmpty(syms1: List[Symbol], syms2: List[Symbol]) = !syms1.exists(syms2.contains)
|
|
+ // CWE-407 fix: syms2.contains on List[Symbol] is O(|syms2|) per call.
|
|
+ // extendedOverriddenSymbols returns O(D) symbols (D = hierarchy depth).
|
|
+ // Original: O(|syms1| x |syms2|) = O(D^2) per pair checked in checkAllOverrides.
|
|
+ // Fix: convert syms2 to a Set[Symbol] once — O(|syms2|) — then O(1) per lookup.
|
|
+ def intersectionIsEmpty(syms1: List[Symbol], syms2: List[Symbol]) = { val s2 = syms2.toSet; !syms1.exists(s2.contains) }
|