Skip to content

Commit b20c83a

Browse files
committed
Perl_op_convert_list - only short circuit CONST OPs with an IsCOW SV
Currently, a CONST OP's SV will not have the `IsCOW` flag set if the PV buffer was truncated such that it is too small to be COWed. In which case, not short circuting `Perl_op_convert_list` causes the OP to undergo constant folding, resulting in a CONST OP with an SV that can participate in COW. This means that the commit which introduced the short-circuit for CONST OPs accidentally introduced a regression: a902d92 This commit adds an additional check to ensure that short circuiting does not happen when the CONST OP SV cannot be COWed. This is a short term workaround given the proximity to the next stable release. #23290 seems like the more appropriate fix, but is a bigger change, so will be held until the next development cycle.
1 parent 11de3f7 commit b20c83a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

op.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -5571,7 +5571,7 @@ Perl_op_convert_list(pTHX_ I32 type, I32 flags, OP *o)
55715571
flags |= OPf_SPECIAL;
55725572
}
55735573
if (type == OP_STRINGIFY && OP_TYPE_IS(o, OP_CONST) &&
5574-
!(flags & OPf_FOLDED) ) {
5574+
!(flags & OPf_FOLDED) && SvIsCOW(cSVOPx_sv(o)) ){
55755575
assert(!OpSIBLING(o));
55765576
/* Don't wrap a single CONST in a list, process that list,
55775577
* then constant fold the list back to the starting OP.

0 commit comments

Comments
 (0)