fix(security): prevent image decompression bomb OOM denial of service (#47010)
Signed-off-by: jperezde <jperezde@redhat.com>
This commit is contained in:
@@ -79,6 +79,7 @@ if TYPE_CHECKING:
|
||||
VLLM_MAX_AUDIO_CLIP_FILESIZE_MB: int = 25
|
||||
VLLM_MAX_AUDIO_DECODE_DURATION_S: int = 600
|
||||
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"
|
||||
VLLM_MEDIA_CONNECTOR: str = "http"
|
||||
VLLM_MM_HASHER_ALGORITHM: str = "blake3"
|
||||
@@ -954,6 +955,13 @@ environment_variables: dict[str, Callable[[], Any]] = {
|
||||
str(max(1, min(os.cpu_count() or 1, 2))),
|
||||
)
|
||||
),
|
||||
# Maximum decoded image size in pixels. Small compressed images can
|
||||
# expand into gigabytes of raster memory. This limit is enforced before
|
||||
# decoding so the memory is never allocated. Default matches PIL's
|
||||
# built-in 2x decompression-bomb threshold (~179M pixels, ~680 MB RGB).
|
||||
"VLLM_MAX_IMAGE_PIXELS": lambda: int(
|
||||
os.getenv("VLLM_MAX_IMAGE_PIXELS", "178956970")
|
||||
),
|
||||
# Backend for Video IO — selects the frame-sampling algorithm.
|
||||
# - "opencv": uniform sampling.
|
||||
# - "opencv_dynamic": duration-aware dynamic sampling.
|
||||
@@ -2083,6 +2091,7 @@ def compile_factors() -> dict[str, object]:
|
||||
"VLLM_MAX_AUDIO_CLIP_FILESIZE_MB",
|
||||
"VLLM_MAX_AUDIO_DECODE_DURATION_S",
|
||||
"VLLM_MAX_AUDIO_PREPROCESS_WORKERS",
|
||||
"VLLM_MAX_IMAGE_PIXELS",
|
||||
"VLLM_VIDEO_LOADER_BACKEND",
|
||||
"VLLM_MEDIA_CONNECTOR",
|
||||
"VLLM_OBJECT_STORAGE_SHM_BUFFER_NAME",
|
||||
|
||||
Reference in New Issue
Block a user