Repository navigation
fix(provider): cap VLM inline-media decode (decompression-bomb OOM) #335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b08f963
6d5d6e2
ef0da10
8a75592
8dec1c2
a3841ce
de9c42d
7893941
ed8e339
678a50f
5721186
c07a4d7
5070d29
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -147,6 +147,20 @@ public struct CORSResponder<Inner: HTTPResponder>: HTTPResponder { | |
| ), | ||
| message: error.localizedDescription | ||
| ) | ||
| } catch let error as VLMRequestInference.MediaError { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
For the real local HTTP path, oversized/malformed inline media is not thrown by Useful? React with 👍 / 👎.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch — you're right that the The issue exactly as you described: on Fix: validate media up front.
Added |
||
| // Local HTTP (`darkbloom start --local`) must give the same | ||
| // status contract as the coordinator WebSocket path: an | ||
| // oversized/malformed/non-`data:` inline-media payload is a client | ||
| // fault (400), not a provider 500. Without this catch a MediaError | ||
| // raised by the VLM media-cap path escapes as the framework's | ||
| // generic 500. Mapping reuses mapInferenceErrorToStatus (400 for | ||
| // every case except the provider-side videoWriteFailed → 500). | ||
| return Self.openAIErrorResponse( | ||
| status: HTTPResponse.Status( | ||
| code: Int(ProviderLoop.mapInferenceErrorToStatus(error)) | ||
| ), | ||
| message: error.localizedDescription | ||
| ) | ||
| } | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.