The vulnerability is a memory exhaustion flaw in aiohttp's websocket handling. The root cause was that the library checked for oversized messages too late in the data processing pipeline. The function aiohttp._websocket.reader_py.WebSocketReader._feed_data reads raw data from the network. Before the patch, it would parse a websocket frame's header, determine the payload length, and immediately start buffering the payload into memory. The check against the maximum allowed message size (max_msg_size) was only performed in the _handle_frame function, which is called after a complete frame has been received and buffered.
An attacker could exploit this by sending a websocket frame header declaring a very large payload. The _feed_data function would begin allocating memory to buffer this large payload. This allows an attacker to cause the server to consume an excessive amount of memory by sending just a small header, leading to a Denial of Service (DoS), without ever needing to send the full, large payload.
The patch rectifies this by moving the size check into the _feed_data function. A new check calculates the projected_size (current partial message size + the size of the incoming frame) and compares it against the _max_msg_size limit before any of the new frame's payload is read or buffered. If the projected size is too large, it immediately raises an exception, preventing the memory allocation. The vulnerable function is therefore _feed_data, as it's the function that improperly buffers data, and its modification is what fixes the vulnerability.