Details
The core of the rollback half: wrap the post-render length check so a ValueError rejection discards the P0 entries the render just committed, before re-raising. Add a discard_sender_cache_item() on the processor cache (no-op default, pop on the sender) and a Renderer.discard_mm_cache_entries() that walks a rendered request's mm_hashes:
# vllm/entrypoints/openai/chat_completion/serving.py (_create_chat_completion)
- max_tokens = get_max_tokens(
- max_model_len,
- ...,
- truncate_prompt_tokens=request.truncate_prompt_tokens,
- )
+ try:
+ max_tokens = get_max_tokens(
+ max_model_len,
+ ...,
+ truncate_prompt_tokens=request.truncate_prompt_tokens,
+ )
+ except ValueError:
+ for rendered_input in engine_inputs:
+ if mm_hashes := rendered_input.get("mm_hashes"):
+ self.renderer.discard_mm_cache_entries(mm_hashes)
+ raise
# vllm/multimodal/cache.py (MultiModalProcessorSenderCache)
+ @override
+ def discard_sender_cache_item(self, mm_hash: str) -> None:
+ self._cache.pop(mm_hash, None)
This closes the max_model_len rejection path; because any other rejection-after-render path reopens the same window, pairing it with the defense-in-depth change above (making the P1 assert a checked, request-scoped error) is recommended.
Credit
Reported by: Patch the Planet (Trail of Bits + OpenAI collaboration)
This vulnerability was discovered using GPT-5.5-Cyber as part of the Patch the Planet security initiative.
---
Proposed fix: a fix for this issue is proposed in a public pull request: https://github.com/vllm-project/vllm/pull/51897