Skip to content

spark-model: refuse a video frame count its payload cannot hold - #295

Merged
AzeezIsh merged 1 commit into
Atlas-Inf:stack/glm-videofrom
Enntity:fix/glm-video-frame-bound
Oct 31, 2026
Merged

AzeezIsh merged 1 commit into
Atlas-Inf:stack/glm-videofrom
Enntity:fix/glm-video-frame-bound

Conversation

@data-angel

Copy link
Copy Markdown
Contributor

Summary

probe_frames took nb_frames, or duration × rate, with no upper bound, and glm_sample_frame_indices grows one usize per sampled step of that count before extract_t applies. Every stored frame takes at least a byte, so this refuses a count above the payload size. An honest clip is unaffected.

Targets stack/glm-video because the walk exists only in #256, not on main.

Test plan

  • cargo fmt --all -- --check
  • cargo clippy --no-deps on the changed code, no warnings. A full run stops on the atlas_glm_kda cfg error already on this stack.
  • bash scripts/check-license-headers.sh: not run, no new files.
  • Real model / hardware: not run.
  • Added declared_frames_reads_nb_frames_then_duration_times_rate and a_frame_count_the_payload_cannot_hold_is_refused.
  • 66 video tests pass.

Patching one stts entry in a 1,848-byte MP4 made ffprobe 7.1.1 report 4,000,000,000 frames. That is about 13 GB of walk by arithmetic; I did not run the allocation. The refusal itself is unit-tested only, not end to end through ffprobe, because the gates container has no ffmpeg.

Notes for reviewers

The bound is deliberately loose: one byte per frame stops the allocation without guessing at real codec sizes.

This is security-relevant and SECURITY.md asks for private reports. The commit was already public on Enntity/atlas when that was noticed, so this comes as a normal PR.

Authorship

AI-authored (Claude Code). No human-written code.

🤖 Generated with Claude Code

probe_frames took nb_frames, or duration × rate, with no upper bound, and
glm_sample_frame_indices grows one usize per sampled step of that count
before extract_t applies. Patching one stts entry in a 1,848-byte MP4 made
ffprobe 7.1.1 report 4,000,000,000 frames, a walk of about 13 GB.

Every stored frame takes at least a byte, so refuse a count above the
payload size. An honest clip is unaffected.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@data-angel
data-angel requested a review from AzeezIsh as a code owner October 31, 2026 17:30
@AzeezIsh
AzeezIsh merged commit c9da15b into Atlas-Inf:stack/glm-video Oct 31, 2026
1 check passed
@data-angel
data-angel deleted the fix/glm-video-frame-bound branch November 3, 2026 05:07
vcruz305 pushed a commit to vcruz305/atlas that referenced this pull request Nov 11, 2026
…-Inf#256)

Port of Atlas-Inf#256 (Enntity/atlas f3f3876 via 5497364, plus 8a8a959 from
Atlas-Inf#295) onto main's Atlas-Inf#286 video path. Atlas-Inf#256's stack base already landed
through Atlas-Inf#282, and the DFlash warm-ctx port from the same stack (Atlas-Inf#255) is
not included. Every video file here is byte-identical to the version
gated in train Atlas-Inf#305.

- ensure_decoder is the single source for the ffmpeg enabled/available
  check, in video_decode_ffmpeg/probe.rs (pub(super)); decode_with_plan
  and frames.rs call it.
- The moov/faststart decode tests use the enabled() policy; on a host
  with ffmpeg they fail on main under FfmpegPolicy::default().
- The GLM reference path pads a single sampled frame into a temporal
  pair. Qwen's generic path is unchanged.
- The generic-path GLM single-frame refusal test is dropped, superseded
  by the reference pad test (the generic GLM branches are now unreachable
  behind the is_glm5_next early return; follow-up).

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants