[Bugfix][Multimodal] Reject malformed base64 audio with 400 instead of 500 - #53744
Merged
Merged
Conversation
…f 500 Signed-off-by: mhuzaifa3 <mhuzaifa3@outlook.com>
Isotr0py
approved these changes
Aug 25, 2026
Isotr0py
enabled auto-merge (squash)
August 25, 2026 16:21
Member
|
/ci run |
|
✅ Triggered Buildkite CI #85522 for commit |
khushali9
pushed a commit
to khushali9/vllm
that referenced
this pull request
Aug 29, 2026
…f 500 (vllm-project#53744) Signed-off-by: mhuzaifa3 <mhuzaifa3@outlook.com> Signed-off-by: khushali9 <khushali.desai9@gmail.com>
am-cohere
pushed a commit
to am-cohere/vllm
that referenced
this pull request
Sep 1, 2026
…f 500 (vllm-project#53744) Signed-off-by: mhuzaifa3 <mhuzaifa3@outlook.com>
mikeshawcode
pushed a commit
to mikeshawcode/vllm
that referenced
this pull request
Sep 1, 2026
…f 500 (vllm-project#53744) Signed-off-by: mhuzaifa3 <mhuzaifa3@outlook.com> Signed-off-by: mikeshawcode <michaelwshaw2@gmail.com>
mikeshawcode
pushed a commit
to mikeshawcode/vllm
that referenced
this pull request
Sep 1, 2026
…f 500 (vllm-project#53744) Signed-off-by: mhuzaifa3 <mhuzaifa3@outlook.com> Signed-off-by: mikeshawcode <michaelwshaw2@gmail.com>
sheralskumar
pushed a commit
to sheralskumar/vllm
that referenced
this pull request
Sep 8, 2026
…f 500 (vllm-project#53744) Signed-off-by: mhuzaifa3 <mhuzaifa3@outlook.com>
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.
Purpose
A malformed base64 audio payload returns HTTP 500. The same payload sent as an image returns 400.
AudioMediaIO.load_base64decodes without strict validation:pybase64then drops any character outside the base64 alphabet and decodes whatever is left. The mangled bytes reach libsndfile, which raisesLibsndfileError. That inherits fromRuntimeError, socreate_error_responsefalls through to itselsebranch and answers 500.The other three media loaders pass
validate=True, so a bad payload raisesbinascii.Error, which inherits fromValueErrorand maps to 400.Running the same malformed string through both loaders on current main:
A client sending a corrupt upload should not see a server error, and it should not differ by media type.
ImageMediaIO,ImageEmbeddingMediaIOandAudioEmbeddingMediaIOalready passvalidate=True.VideoMediaIOdelegates toImageMediaIO. Audio was the only loader left.Related, not fixed here
A genuinely corrupt audio or image file, where the base64 is valid but the decoded bytes are not media, still returns 500:
LibsndfileErrorand PIL'sUnidentifiedImageErrorare neitherValueErrornorVLLMError. Mapping decode failures to a client error means deciding between 400 and 422 and touching the connector, so I left it out. Happy to open an issue if that is worth tracking.Test Plan
test_audio_media_io_load_base64_rejects_malformedbuilds a valid payload, splices non-alphabet characters into it, and asserts the loader raisesValueError.Test Result
test_audio.pywith the fix:The failure is
test_audio_media_io_from_video, which needs video assets my machine does not have. It fails the same way on an unmodified checkout.The new test with
audio.pyreverted to main:Wider media suite, with the fix:
Unmodified checkout, same command:
Same failures either way, from missing
cv2and from tests that reach the network. The extra pass is the new test.ruff checkandruff format --checkpass on both files.I ran no accuracy or performance tests. This rejects input that already failed, one step earlier and with the right status code.
Note
AI assistance was used for this change. I reviewed every changed line, ran the tests above, and can explain the change.