-
Notifications
You must be signed in to change notification settings - Fork 163
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
Handle infinite recursion in attribute methods #3221
Handle infinite recursion in attribute methods #3221
Conversation
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.
Seems plausible to me.
src/funcs.c
Outdated
|
||
#define CHECK_RECURSION_AFTER \ | ||
DecRecursionDepth(); \ | ||
HookedLineOutFunction(func); |
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.
Nitpick, but: the names of those macros now are kinda wrong...
Of course this probably introduces a small performance penalty, but I think that not crashing by accident in the middle of a long a and complicated computation beats that. Though I do wonder how bad the overhead is in practice? It should only affect non-GAP functions, i.e., kernel functions. Perhaps we can do some micro benchmarking to test it? Hopefully that would show it is negligible. (I'm not insisting on this, I already approved the PR; just wondering out loud). |
I did some very basic benchmarking and couldn't measure it. If we wanted to speed things up, it would probably be worth pulling the functions I'm calling into a header, so they can be inlined. |
The main purpose of this patch is to fix stack-depth-operation.g. Rather than handle that specially, move where we handle stack depth, to consistently handle all problems
2d1c2a1
to
ec00a88
Compare
Codecov Report
@@ Coverage Diff @@
## master #3221 +/- ##
==========================================
+ Coverage 84.77% 84.77% +<.01%
==========================================
Files 688 688
Lines 335887 336415 +528
==========================================
+ Hits 284738 285198 +460
- Misses 51149 51217 +68
|
The main purpose of this patch is to fix
tst/testspecial/stack-depth-func.g
.Rather than handle that specially, move where we handle stack
depth, to consistently handle all problems.
Fixes #1286
If anyone can think of another way we could cause a stack overflow, let me know here and I'll add it as a test.