Add explicit recursion limits to avoid stack overflows#420
Conversation
|
@torkleyy Does this API change look good to you? If so, feel free to squash and merge. I would be surprised if anyone is using such highly recursive data structures in the wild and would be affected by the default limit. Hence, this might be a v0.9 change? |
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #420 +/- ##
==========================================
- Coverage 93.06% 87.19% -5.87%
==========================================
Files 56 57 +1
Lines 6618 7117 +499
==========================================
+ Hits 6159 6206 +47
- Misses 459 911 +452 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Part of the codecov regression is spurious, part is expected. As I've spent the past few commits increasing codecov this is unfortunate, but I'll get to adding coverage for the stack overflow checks at some point :) |
|
@torkleyy As you might be busy, I will merge this PR on Friday if you don’t object. While this change would break deeply nested structures, I think this can be dealt with by pushing the change to 0.9 instead of 0.8.1. Apart from a new error, the API update is a non-breaking change. |
torkleyy
left a comment
There was a problem hiding this comment.
Yes limiting the recursion limit is certainly useful especially for untrusted inputs. 👍
* Explicit recursion limit during deserializing * Explicit recursion limit during serializing * Added CHANGELOG entry
* Explicit recursion limit during deserializing * Explicit recursion limit during serializing * Added CHANGELOG entry
Fixes #307 and the long-standing potential for stack overflows while serialising or deserialising.
Now,
ron::Optionsis by default configured for a recursion limit of 128 (here recursion is very loosely defined). This limit can be adjusted or disabled.This bug was first reported by @5225225 in #307 and later by oss-fuzz.
This PR also slightly extends the
from_strfuzz target to check serialising as well.CHANGELOG.md