rustbot
rustbot copied to clipboard
OOM when deserializing too large of a eval response
If you run a command that causes the playground to respond with a Very Large amount of data (like ?eval [(); 1_000_000]
), then formatting that will OOM the bot because the response size is not limited.
Reqwest has https://github.com/seanmonstar/reqwest/issues/1234 which seems to be "no there is no easy API for it", but we could move from .json()
to using https://docs.rs/reqwest/latest/reqwest/struct.Response.html#method.chunk which you could loop and read into a local Vec, and bail out if that vec gets too large (over 1MB?). And/or check the content-length?
Context: https://discord.com/channels/273534239310479360/818964227783262209/1018843827739574302