From 923a39c59285eb06a7c6ca4ce01d2cec711fcfac Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Wed, 21 Apr 2021 13:47:49 +1000 Subject: [PATCH] workaround unexpected op trees generated by Data::Alias Data::Alias can produce intermediate leave ops that don't have the expected: leave enter moreops structure, which breaks in Perl_scalar() and Perl_list() with the new(ish) non-recursive crawl of the OP tree permitted with PERL_OP_PARENT. This doesn't fix a more recent parsing issue. --- op.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/op.c b/op.c index 594d4ee9c329..45d50f77fb22 100644 --- a/op.c +++ b/op.c @@ -1964,6 +1964,11 @@ Perl_scalar(pTHX_ OP *o) case OP_LEAVETRY: kid = cLISTOPo->op_first; scalar(kid); + if (!OpHAS_SIBLING(kid)) { + /* handle broken leave trees */ + next_kid = kid; + goto do_next; + } kid = OpSIBLING(kid); do_kids: while (kid) { @@ -2552,6 +2557,11 @@ Perl_list(pTHX_ OP *o) case OP_LEAVETRY: kid = cLISTOPo->op_first; list(kid); + if (!OpHAS_SIBLING(kid)) { + /* handle broken leave trees */ + next_kid = kid; + goto do_next; + } kid = OpSIBLING(kid); do_kids: while (kid) {