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
Segfault when accessing pad_compname_type #16387
Comments
From konkove@gmail.comCreated by @KES777When pp_entersub is done we can access to its PAD: SV *sv = PAD_SV( ix ); But when we try to access to pad_compname_type we will get SEGFAULT For next short script when `test` is called PL_comppad_name will point test(); And here if we dump PADnames it will dump PL_main_cv PADNAMES: my $y #Dump padname: This error belongs to all macroses which use PAD_COMPNAME(po) macros. PAD_SET_CUR_NOSAVE(padlist, depth); Looking into this macro (pad.h:370): We can see that PL_comppad_name is not initialized at all Here is patch: Prevent segfault because of uninitialized PL_comppad_name Inline Patchdiff --git a/pad.h b/pad.h
index 976dc058d4..4e59a0f30d 100644
--- a/pad.h
+++ b/pad.h
@@ -370,6 +370,7 @@ Restore the old pad saved into the local variable
Possible other PAD_* macroses should be reviewed too. Also here is patch to clarify code a bit: PAD_COMPNAME_GEN*: reuse code from PAD_COMPNAME macros Inline Patchdiff --git a/pad.h b/pad.h
index 4e59a0f30d..f69a009ead 100644
--- a/pad.h
+++ b/pad.h
@@ -456,11 +456,8 @@ ling pad (lvalue) to C<gen>.
#define PAD_COMPNAME_OURSTASH(po) \
(SvOURSTASH(PAD_COMPNAME_SV(po)))
-
+
-#define PAD_COMPNAME_GEN(po) \
- ((STRLEN)PadnamelistARRAY(PL_comppad_name)[po]->xpadn_gen)
-
-#define PAD_COMPNAME_GEN_set(po, gen) \
- (PadnamelistARRAY(PL_comppad_name)[po]->xpadn_gen = (gen))
+#define PAD_COMPNAME_GEN(po) ((STRLEN)PAD_COMPNAME(po)->xpadn_gen)
+#define PAD_COMPNAME_GEN_set(po, gen) (PAD_COMPNAME(po)->xpadn_gen = (gen))
-
+
-
+
/* Perl Info
|
From zefram@fysh.orgEugen Konkov wrote:
Not a bug. pad_compname_type() is explicitly documented to refer to -zefram |
The RT System itself - Status changed from 'new' to 'open' |
From @KES777PL_comppad and PL_comppad_name are named similarly, so they should have similar behavior It will be handy to have one PL_curcv and Also PL_curcv maybe returned from find_runcv(0) |
From @iabynOn Tue, Jan 30, 2018 at 02:02:25AM -0800, KES via RT wrote:
That is not a valid reason for changing the existing behaviour.
All that extra state would incur overhead on each function call and On the other hand, I've been considering for a while implementing a -- |
Migrated from rt.perl.org#132774 (status was 'open')
Searchable as RT132774$
The text was updated successfully, but these errors were encountered: