Fix DoS via sample-rate forgery bypassing audio decode duration guard (#49948)
Signed-off-by: jperezde <jperezde@redhat.com> Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
37fbf52084
commit
640a09086d
@@ -77,6 +77,7 @@ if TYPE_CHECKING:
|
||||
VLLM_MEDIA_LOADING_THREAD_COUNT: int = 8
|
||||
VLLM_MAX_AUDIO_CLIP_FILESIZE_MB: int = 25
|
||||
VLLM_MAX_AUDIO_DECODE_DURATION_S: int = 600
|
||||
VLLM_MAX_AUDIO_DECODE_BYTES: int = 268_435_456
|
||||
VLLM_MAX_AUDIO_PREPROCESS_WORKERS: int = max(1, min(os.cpu_count() or 1, 2))
|
||||
VLLM_MAX_IMAGE_PIXELS: int = 178_956_970
|
||||
VLLM_VIDEO_LOADER_BACKEND: str = "opencv"
|
||||
@@ -986,6 +987,14 @@ environment_variables: dict[str, Callable[[], Any]] = {
|
||||
"VLLM_MAX_AUDIO_DECODE_DURATION_S": lambda: int(
|
||||
os.getenv("VLLM_MAX_AUDIO_DECODE_DURATION_S", "600")
|
||||
),
|
||||
# Maximum float32 PCM bytes that audio decoding may allocate.
|
||||
# Guards against sample-rate forgery where an attacker inflates
|
||||
# the header sample rate to bypass the duration guard while the
|
||||
# actual frame count still causes a multi-GiB allocation.
|
||||
# Default is 256 MiB (sufficient for 600s mono 48 kHz float32).
|
||||
"VLLM_MAX_AUDIO_DECODE_BYTES": lambda: int(
|
||||
os.getenv("VLLM_MAX_AUDIO_DECODE_BYTES", "268435456")
|
||||
),
|
||||
# Maximum number of worker threads used for STT preprocessing. The default
|
||||
# intentionally caps at 2 because that performed best in profiling.
|
||||
# https://github.com/vllm-project/vllm/pull/44612#issuecomment-4662757781
|
||||
@@ -2206,6 +2215,7 @@ def compile_factors() -> dict[str, object]:
|
||||
"VLLM_MEDIA_LOADING_THREAD_COUNT",
|
||||
"VLLM_MAX_AUDIO_CLIP_FILESIZE_MB",
|
||||
"VLLM_MAX_AUDIO_DECODE_DURATION_S",
|
||||
"VLLM_MAX_AUDIO_DECODE_BYTES",
|
||||
"VLLM_MAX_AUDIO_PREPROCESS_WORKERS",
|
||||
"VLLM_MAX_IMAGE_PIXELS",
|
||||
"VLLM_VIDEO_LOADER_BACKEND",
|
||||
|
||||
Reference in New Issue
Block a user