stop -MO=Concise -e'm?x?' segfaulting
authorDavid Mitchell <davem@iabyn.com>
Wed, 9 Jan 2013 11:46:26 +0000 (11:46 +0000)
committerDavid Mitchell <davem@iabyn.com>
Wed, 9 Jan 2013 15:11:47 +0000 (15:11 +0000)
commit2721a2ca2e5e889d70ac085ed55ccd9d7b91a378
tree86d31121d424d4f4afa27401cdd6488665e0e045
parent4e1acb291800b39d2be33ac9f9ae4fb026868cc3
stop -MO=Concise -e'm?x?' segfaulting

The op_pmreplstart field in a PMOP is actually a union, containing
op_pmreplstart for OP_SUBST, and op_pmstash/op_pmstashoff for OP_MATCH
with PMf_ONCE set.

The B pmreplstart method just blindly treated the value of this field as
an op pointer, even when it wasn't an OP_SUBST. Hence the segfault.
Make it instead return a null pointer when not OP_SUBST.

At the same time I improved the PMOP handling code in Concise.xs so that
it expects particular types for that and the op_pmreplrootu union based on
the op type (OP_SUBST or OP_PUSHRE) rather than trying to handle any field
value regardless of op type.
ext/B/B.pm
ext/B/B.xs
ext/B/B/Concise.pm
ext/B/t/optree_misc.t