This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
if an SV IsCOW_shared_hash then we can assume it has a null at the end
authorYves Orton <demerphq@gmail.com>
Sun, 25 Feb 2018 13:29:03 +0000 (14:29 +0100)
committerYves Orton <demerphq@gmail.com>
Sun, 25 Feb 2018 16:15:12 +0000 (17:15 +0100)
regcomp.c

index 446f0bf..f8d9771 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -6510,7 +6510,7 @@ S_concat_pat(pTHX_ RExC_state_t * const pRExC_state,
                  * it is properly null terminated or we will fail asserts
                  * later. In theory we probably shouldn't get such SV's,
                  * but if we do we should handle it gracefully. */
-                if ( SvTYPE(msv) != SVt_PV || (SvLEN(msv) > SvCUR(msv) && *(SvEND(msv)) == 0) ) {
+                if ( SvTYPE(msv) != SVt_PV || (SvLEN(msv) > SvCUR(msv) && *(SvEND(msv)) == 0) || SvIsCOW_shared_hash(msv) ) {
                     /* not a string, or a string with a trailing null */
                     pat = msv;
                 } else {