Skip to content

Commit ecc1077

Browse files
committed
CLEAR_ERRSV: create a new SV if the existing one isGV_with_GP
GH #16885 is a fuzzer-identified assert in Perl_sv_grow. Besides the question of how the program should behave, the actual assertion comes via the `SvPVCLEAR()` statement in `CLEAR_ERRSV`, where `svp` is unexpectedly a PVGV with GV. This commit treats this the same as if `svp` was READONLY - the refcount is decremented and `svp` assigned a brand new SVt_PV.
1 parent d4c2561 commit ecc1077

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

perl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1947,7 +1947,7 @@ any magic.
19471947
SV ** const svp = &GvSV(PL_errgv); \
19481948
if (!*svp) { \
19491949
*svp = newSVpvs(""); \
1950-
} else if (SvREADONLY(*svp)) { \
1950+
} else if (SvREADONLY(*svp) || isGV_with_GP(*svp)) { \
19511951
SvREFCNT_dec_NN(*svp); \
19521952
*svp = newSVpvs(""); \
19531953
} else { \

0 commit comments

Comments
 (0)