Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit 71e8558

Browse files
iabynReini Urban
authored andcommitted
only treat stash entries with .*:: as sub-stashes
RT #128238 %: = 0 would cause an assertion failure in Perl_gv_check(), since when it searched a stash for substashes, it assumed anything ending in ':' was a substash, whereas substashes end in '::'. So check for a double colon before recursing.
1 parent b229fcf commit 71e8558

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

gv.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2450,7 +2450,10 @@ Perl_gv_check(pTHX_ HV *stash)
24502450
for (entry = HvARRAY(stash)[i]; entry; entry = HeNEXT(entry)) {
24512451
GV *gv;
24522452
HV *hv;
2453-
if (HeKEY(entry)[HeKLEN(entry)-1] == ':' &&
2453+
STRLEN keylen = HeKLEN(entry);
2454+
const char * const key = HeKEY(entry);
2455+
2456+
if (keylen >= 2 && key[keylen-2] == ':' && key[keylen-1] == ':' &&
24542457
(gv = MUTABLE_GV(HeVAL(entry))) && isGV(gv) && (hv = GvHV(gv)))
24552458
{
24562459
if (hv != PL_defstash && hv != stash

0 commit comments

Comments
 (0)