The vulnerability lies in Salvo's handling of application/x-www-form-urlencoded and multipart/form-data request bodies. The core issue was that the function salvo::http::form::FormData::read would read the entire request body into memory before parsing, without enforcing any size limits. This was exposed to developers through several high-level API functions, most notably salvo::http::request::Request::form_data and salvo::http::request::Request::parse_body_with_max_size. An attacker could exploit this by sending a request with an extremely large body, causing the server to allocate an unbounded amount of memory, which would lead to an Out-of-Memory (OOM) crash and a Denial of Service. The vulnerability also affected any data structures using the Extractible derive macro to parse from the request body, as this macro's generated code would call these vulnerable functions.
The patch addresses this by introducing a size limit to the body parsing process. A new function, Request::form_data_max_size, was introduced, which wraps the request body in a Limited stream from the http_body_util crate. This ensures that reading from the body stops once the specified size limit is reached, preventing unbounded memory allocation. The existing Request::form_data function was updated to use this new size-limited function by default, effectively patching the primary attack vector.