java-topology/whitepaper/outreach/kdenlive-0010.md
russell@unturf.com 652608142a feat: close outreach doc gap — 276 docs (batches 11-16)
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.
2026-04-15 13:57:42 -04:00

2.8 KiB
Raw Blame History

Kdenlive — CWE-407 Disclosure Brief (kdenlive-0010)

2026-04-13 · Patch available — awaiting upstream merge

Finding

One O(P*K²) defect in Kdenlive's keyframe consistency checker. The KeyframeModelList::checkConsistency() method uses QList::contains() in two nested loops to build and verify a union of keyframe positions across linked effect parameters.

The Defect

kdenlive-0010 (PATCHED — MEDIUM): src/assets/keyframes/model/keyframemodellist.cpp:900

// Phase 1: building fullList — O(P * K^2)
QList<GenTime> fullList;
for (const auto &param : m_parameters) {
    QList<GenTime> list = param.second->getKeyframePos();
    for (auto &time : list) {
        if (!fullList.contains(time)) {  // O(K) per element
            fullList << time;
        }
    }
}

// Phase 2: checking consistency — O(P * K^2)
for (const auto &param : m_parameters) {
    QList<GenTime> list = param.second->getKeyframePos();
    for (auto &time : fullList) {
        if (!list.contains(time)) {  // O(K) per element
            // report missing keyframe...
        }
    }
}

Both phases call QList::contains() inside nested loops, each producing O(P*K²) where P = parameter count and K = keyframe count per parameter.

Complexity Proof

At K=500 keyframes, P=3 parameters:

  • Defective: 3 × 500 × 250 (avg) × 2 phases = 750,000 comparisons
  • Fixed: 3 × 500 × log₂(500) × 2 phases = ~27,000 comparisons
  • ~28× op reduction at K=500. ~166× at K=1,000.

Impact

Kdenlive is a popular open-source video editor. Keyframe consistency checking fires when loading clips with multi-parameter effects (position, scale, opacity, rotation). Motion-tracked and heavily animated clips commonly reach hundreds or thousands of keyframes.

The Fix

Use std::set<GenTime> for O(log K) lookup in both phases:

// Phase 1: O(P * K * log K)
std::set<GenTime> fullSet;
for (auto &time : list) {
    if (fullSet.insert(time).second) { fullList << time; }
}

// Phase 2: O(P * K * log K)
const std::set<GenTime> listSet(list.begin(), list.end());
if (listSet.find(time) == listSet.end()) { /* missing */ }

Patch

Fix available: defects/kdenlive-0010/patch/kdenlive-0010-keyframemodellist-checkconsistency-qlists-contains.patch

Single-file patch in keyframemodellist.cpp. ~166× speedup at K=1,000 keyframes.

What We Ask

A patch is ready for review.

  1. Confirm receipt and assign a GitHub issue reference (KDE/kdenlive).
  2. Assess severity — fires on clip load for multi-parameter effects.
  3. Coordinate a disclosure date — we are targeting 90 days from first contact.
  4. We will credit the Kdenlive team in the public disclosure. Preferred acknowledgment format welcome.

Contact: see cover email. This brief is confidential until coordinated disclosure.