AIStudio2API
AIStudio2API copied to clipboard
[Bug] POST /v1/videos reads multipart input_reference with unbounded io.ReadAll (up to maxPublicBodyBytes ~682 MB in RAM)
发生了什么 / What happened
Summary
In internal/api/video.go:351-357, parseOpenAIVideoRequest reads the uploaded input_reference image into memory with no size cap:
file, header, err := r.FormFile("input_reference")
if err == nil {
defer file.Close()
data, readErr := io.ReadAll(file)
A multipart upload up to maxPublicBodyBytes (~682 MB) is read completely into RAM without checking header.Size or wrapping with io.LimitReader.
Suggested Fix
Enforce an image/upload size limit (e.g., check header.Size and wrap file with io.LimitReader) before reading into memory.
版本 / Version
v0.3.14
每人最多同时打开 3 个 Issue,这个 Issue 已自动关闭。请等已有的 Issue 处理完再提,或把内容补充到已有的 Issue 里。
Each user can have at most 3 open issues at a time, so this one was closed automatically. Please wait until your existing issues are resolved, or add this to one of them.