Files
Miguel Pires 01332a4f1d aspects: limit Set value's nestedness (#13815)
Limit how many nested levels a value can have. This is necessary because
we recurse to traverse objects and it takes much less memory to create
an object that it takes to traverse it. Here are my back-of-the-envelope
calculations, please let me know if anything is off: the default limit
on the http request body is 10Mb, since a nested level in the JSON
object takes just 6 bytes {"a": ...} the API would accept JSON with more
than 1.7 million levels and recursing into them would (at a 2Kb min
stack size) take 3.5Gb. Limiting the recursion levels to 4096 keeps the
stack size in the low MBs.

Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
2024-04-12 11:32:03 +02:00
..