-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 ReportBase: 93.06% // Head: 87.19% // Decreases project coverage by
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
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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::Options
is 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_str
fuzz target to check serialising as well.CHANGELOG.md