fix SEGV in /\N{...}/
David Mitchell [Fri, 22 Jan 2010 12:57:27 +0000 (12:57 +0000)]
A simple program like the following could coredump:

    use charnames ':full';
    /\N{LATIN SMALL LETTER E}/;

The moral being, make sure sp is synced on return from call_sv()
*before* using the stack!

(Was a regression since 5.10)

regcomp.c

index 337f0c4..10f97b9 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -6734,13 +6734,13 @@ S_reg_namedseq(pTHX_ RExC_state_t *pRExC_state, UV *valuep, I32 *flagp)
             PUTBACK ;
             
             count= call_sv(cv, G_SCALAR);
+            SPAGAIN ;
             
             if (count == 1) { /* XXXX is this right? dmq */
                 sv_str = POPs;
                 SvREFCNT_inc_simple_void(sv_str);
             } 
             
-            SPAGAIN ;
             PUTBACK ;
             FREETMPS ;
             LEAVE ;