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
Programming more defensively to avoid SEGV #74
base: master
Are you sure you want to change the base?
Conversation
This should also be ported to Sub::Name as well. |
(as per IRC but here again for completeness) Can you provide a test case, or otherwise an example of what situations cause the bug that this code is fixing? |
Minimal repro:
|
Additional info, if relevant: the bit that blows up is |
@karenetheridge Doing so now! |
Can you post a stacktrace of that crash? |
This fix is wrong. |
See Dual-Life#74 for the testcase (Devel::Cover providing no stash)
in set_subname. See Dual-Life/Scalar-List-Utils#74 for the testcase (Devel::Cover providing no stash)
The fix by @rurban does look more logical to me, though I'm still wondering how a CV ends up with a stashless GV |
@Leont belatedly:
Do you want me to change my fix to be the same as @rurban 's? Or can you just cherry-pick his? I'm keen for SEGVs to not happen, I don't mind whose code makes it so :-) |
In either case, this really needs a test. |
It certainly does. Sadly I don't know what triggers the behaviour it's protecting from. |
In certain circumstances, doing a
set_subname
has caused SEGV while running under Devel::Cover. I have not dug very deeply into exactly why, but I can show the repro case if needed. The immediate reason is that in that scenario,GvSTASH(oldgv)
returns NULL, yet HvNAME is called on it.This patch makes the block only continue with the attempt to "under debugger, provide information about sub location" if
oldhv
is not NULL.