PATCH: [perl #131598]
authorKarl Williamson <khw@cpan.org>
Fri, 25 Aug 2017 17:33:58 +0000 (11:33 -0600)
committerSteve Hay <steve.m.hay@googlemail.com>
Sun, 10 Sep 2017 11:48:54 +0000 (12:48 +0100)
The cause of this is that the vFAIL macro uses RExC_parse, and that
variable has just been changed in preparation for code after the vFAIL.
The solution is to not change RExC_parse until after the vFAIL.

This is a case where the macro hides stuff that can bite you.

regcomp.c

index a489cde..c83315c 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -12196,14 +12196,16 @@ S_grok_bslash_N(pTHX_ RExC_state_t *pRExC_state,
        }
         sv_catpv(substitute_parse, ")");
 
-        RExC_parse = RExC_start = RExC_adjusted_start = SvPV(substitute_parse,
-                                                             len);
+        len = SvCUR(substitute_parse);
 
        /* Don't allow empty number */
        if (len < (STRLEN) 8) {
             RExC_parse = endbrace;
            vFAIL("Invalid hexadecimal number in \\N{U+...}");
        }
+
+        RExC_parse = RExC_start = RExC_adjusted_start
+                                              = SvPV_nolen(substitute_parse);
        RExC_end = RExC_parse + len;
 
         /* The values are Unicode, and therefore not subject to recoding, but