In perl.git, the branch blead has been updated

<https://perl5.git.perl.org/perl.git/commitdiff/5d26d78791c18cfb2ce66f44cbf8e9679dcd23ec?hp=4510b393500f9f3cd77fafbbee5bdd37be8e4594>

- Log -----------------------------------------------------------------
commit 5d26d78791c18cfb2ce66f44cbf8e9679dcd23ec
Author: David Mitchell <da...@iabyn.com>
Date:   Fri Aug 9 11:11:19 2019 +0100

    fix size-miscalculation upgrading LISTOP TO LOOPOP
    
    RT #134344
    
    My recent commit v5.31.2-54-g8c47b5bce7 broke some CAN modules because
    the code in Perl_newFOROP() wasn't accounting for the overhead in the
    opslot struct when deciding whether an allocated LISTOP was large enough
    to be upgraded in-place to a LOOPOP.

-----------------------------------------------------------------------

Summary of changes:
 op.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/op.c b/op.c
index 5d0b1dae3a..86251047b6 100644
--- a/op.c
+++ b/op.c
@@ -9287,7 +9287,8 @@ Perl_newFOROP(pTHX_ I32 flags, OP *sv, OP *expr, OP 
*block, OP *cont)
     /* upgrade loop from a LISTOP to a LOOPOP;
      * keep it in-place if there's space */
     if (loop->op_slabbed
-        && OpSLOT(loop)->opslot_size < SIZE_TO_PSIZE(sizeof(LOOP)))
+        &&    OpSLOT(loop)->opslot_size
+            < SIZE_TO_PSIZE(sizeof(LOOP)) + OPSLOT_HEADER_P)
     {
         /* no space; allocate new op */
        LOOP *tmp;

-- 
Perl5 Master Repository

Reply via email to