[Security] Enforce server-side num_frames ceiling in VideoMediaIO merge - #51969
Open
jperezdealgaba wants to merge 1 commit into
Open
[Security] Enforce server-side num_frames ceiling in VideoMediaIO merge#51969jperezdealgaba wants to merge 1 commit into
jperezdealgaba wants to merge 1 commit into
Conversation
Request-level media_io_kwargs could override the engine num_frames setting with -1 or an arbitrarily large value, bypassing the frame-count protection added by PR vllm-project#38636 for CVE-2026-34755. This restores request-controlled, linearly scalable memory allocation at the video/jpeg decoder. Clamp the merged num_frames to the engine ceiling inside VideoMediaIO.merge_kwargs so that requests can only lower, never raise or disable, the operator limit. Engine num_frames=-1 (operator unlimited) is respected; absent engine config falls back to the constructor default of 32. Signed-off-by: Juan Pérez de Algaba <jperezde@redhat.com> Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: jperezde <jperezde@redhat.com>
jperezdealgaba
requested review from
DarkLight1337,
NickLucche,
shen-shanshan,
tjtanaa and
ywang96
as code owners
August 12, 2026 09:12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
media_io_kwargs.video.num_frames=-1(or an arbitrarily large positive value) could override the engine frame-count ceiling, restoring the unboundedvideo/jpegdecode path that PR (security) Enforce frame limit in VideoMediaIO #38636 was meant to close.VideoMediaIO.merge_kwargs: whenruntime_kwargsare present, the mergednum_framesis clamped to the engine ceiling (positive engine value → hard max; engine-1→ operator unlimited; absent → constructor default of 32). Requests may lower but never raise the ceiling.Test plan
TestMergeKwargsNumFramesCeiling: 10 merge-policy unit tests covering clamp of-1, oversized, lower-allowed, engine unlimited, absent/empty defaults, fps-only wipe, and no-runtime passthrough.test_merge_then_load_base64_enforces_ceiling: integration test throughmerge_media_io_kwargs→VideoMediaIO.load_base64("video/jpeg", ...)confirming frame count is bounded.tests/multimodal/media/test_video.pypass (including pre-existing GPU-backend and decode tests)..venv/bin/python -m pytest tests/multimodal/media/test_video.py -v # 46 passed in 6.87sMade with Cursor