java-topology/defects/x264-scan/CLEAN.md

2.1 KiB

x264 — 5-MOAD Scan Result: CLEAN

Scanned: 2026-03-31 Repo: https://code.videolan.org/videolan/x264.git (depth=1) Language: C

MOAD-0001 (CWE-407): CLEAN

x264 is a pure H.264 video encoder. All collection scans over reference frame lists and motion vector candidate lists are bounded by codec-spec constants:

  • X264_REF_MAX = 16 reference frames maximum (H.264 spec limit)
  • i_mvc (MV predictor candidates): bounded by spatial neighbor count (~4)
  • x264_predictor_clip() in common/common.h: single O(N) pass over MV candidates, deduplicates only against pmv (one value), not against each other
  • analyse_weight_frame() in encoder/analyse.c: O(R^2) inner weight plane scaling but R is bounded by X264_REF_MAX = 16, making it O(256) constant
  • ratecontrol.c nested loops: outer over num_entries (frames), inner over cplxblur window (fixed ~20 frames) = O(F * 20), not O(F^2)
  • Reference list reorder check in encoder/encoder.c: O(R) per list, R <= 16

No unbounded O(N^2) list membership patterns found.

MOAD-0002 (Intertangle): CLEAN

x264_t is a per-encoder context struct passed explicitly to all functions. No global mutable singleton state is shared across encoder instances. Each thread in frame-parallel mode gets its own x264_t slice context. No god object anti-pattern.

MOAD-0003 (Leaked Context): CLEAN

No ThreadLocal / __thread / pthread_key usage found. x264 is C-based and uses explicit context passing via x264_t*. No request-scoped identity carried on thread.

MOAD-0004 (CWE-312 Logged Secret): CLEAN

x264 is a pure codec library with no authentication, credential, or token data flows. x264_log() calls log encoder state, frame type decisions, and file path errors. No credential exposure possible. File paths logged in error cases do not contain auth tokens (codec CLIs do not accept rtsp://user:pass@host style input natively).

MOAD-0005 (Thundering Herd): CLEAN

x264 frame allocation uses x264_frame_pop_unused() from a pre-allocated pool, called under x264_encoder_encode() which is documented as not thread-safe (caller serializes). No concurrent get+null+compute+put cache pattern.