fix(security): prevent image decompression bomb OOM denial of service (#47010)

Signed-off-by: jperezde <jperezde@redhat.com>
This commit is contained in:
Juan Pérez de Algaba
2026-06-30 09:39:22 +00:00
committed by GitHub
parent 06fae69114
commit 364ee36af1
7 changed files with 115 additions and 12 deletions
@@ -44,12 +44,6 @@ AUDIO_CONTEXT = "<so_embedding>"
# MAX_FRAMES = 16
DEFAULT_NUM_TILES = 12
# Configure PIL to handle large images without warnings
# This prevents DecompressionBombWarning for legitimate large images
Image.MAX_IMAGE_PIXELS = None # Disable the limit entirely
# Alternative: Set a specific higher limit
# Image.MAX_IMAGE_PIXELS = 300000000 # ~300M pixels
def calculate_timestamps(
indices: list[int] | torch.Tensor,
@@ -10,12 +10,6 @@ from vllm.tokenizers.hf import HfTokenizer
from .internvl import InternVLImageProcessor, InternVLProcessor
# Configure PIL to handle large images without warnings
# This prevents DecompressionBombWarning for legitimate large images
Image.MAX_IMAGE_PIXELS = None # Disable the limit entirely
# Alternative: Set a specific higher limit
# Image.MAX_IMAGE_PIXELS = 300000000 # ~300M pixels
def build_transform(input_size: int):
return T.Compose(