summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorPaul "LeoNerd" Evans <leonerd@leonerd.org.uk>2022-07-26 23:03:18 +0100
committerPaul Evans <leonerd@leonerd.org.uk>2022-08-03 09:52:06 +0100
commit4dd48237e57323de056710e155ba3be1fd67c65f (patch)
tree86496988954f700961fbf23d88a98a2b2527ce28 /toke.c
parent4b0ceb86a69dee7c4031370d54c78b64f3c3ee06 (diff)
downloadperl-4dd48237e57323de056710e155ba3be1fd67c65f.tar.gz
OP_RUNCV should be created by newSVOP()
This is in case rpeep converts it into an OP_CONST; it will need the space big enough to be a full SVOP. Before this commit it called `newPVOP()` which wasn't technically correct, but since sizeof(PVOP) == sizeof(SVOP) nothing actually broke when the memory slab was reused. However if the definition of either op type is changed so this is no longer the case, it may cause otherwise hard-to-debug memory corruption.
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/toke.c b/toke.c
index d7f27a48de..b68099d422 100644
--- a/toke.c
+++ b/toke.c
@@ -7772,9 +7772,12 @@ yyl_word_or_keyword(pTHX_ char *s, STRLEN len, I32 key, I32 orig_keyword, struct
return yyl_fake_eof(aTHX_ LEX_FAKE_EOF, FALSE, s);
case KEY___SUB__:
+ /* If !CvCLONE(PL_compcv) then rpeep will probably turn this into an
+ * OP_CONST. We need to make it big enough to allow room for that if
+ * so */
FUN0OP(CvCLONE(PL_compcv)
? newOP(OP_RUNCV, 0)
- : newPVOP(OP_RUNCV,0,NULL));
+ : newSVOP(OP_RUNCV, 0, &PL_sv_undef));
case KEY_AUTOLOAD:
case KEY_DESTROY: