mirror of
https://github.com/rclone/rclone.git
synced 2026-10-09 14:39:28 -04:00
Streamed multipart UploadPart called Reserve(contentLength) before reading any body bytes, so the pool immediately allocated one 1 MiB page per MiB of the client-declared Content-Length (or X-Amz-Decoded-Content-Length). An client could declare a huge part size, send no body, and force an arbitrarily large allocation without paying the bandwidth cost of the declared body. Drop the Reserve so the pool-backed buffer grows a page at a time as the body is actually read: memory now tracks the bytes received, not the unverified header. (cherry picked from commit 8f2ad09941b0d69b67366101d5c2c350ca2a12df)