In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/ccb2541ccb4742d6b229bcccef1d90c4d49d849e?hp=63c0bfd59562325fed2ac5a90088ed40960ac2ad>

- Log -----------------------------------------------------------------
commit ccb2541ccb4742d6b229bcccef1d90c4d49d849e
Author: Karl Williamson <[email protected]>
Date:   Thu Mar 10 08:22:00 2011 -0700

    regexec.c: Add assert() to detect inconsistent ANYOF
    
    There have been various segfaults apparently due to trying to access
    the swash (and allies) portion of an ANYOF which doesn't have that.
    This doesn't show up on all platforms.  The assert() should detect
    this and help debugging

M       regexec.c

commit 6f8d7d0df3e3141d61246e6b0a3db12ab1fd7f92
Author: Karl Williamson <[email protected]>
Date:   Thu Mar 10 08:17:05 2011 -0700

    regexec.c: Fix precedence
    
    Commit ac51e94be5daabecdeb0ed734f3ccc059b7b77e3 didn't
    do what it purported, because it omitted parentheses that
    were necessary to change the natural precedence.  It's strange that
    it passed all tests on my machine, and failed so miserably elsewhere
    that it was quickly reverted by commit
    63c0bfd59562325fed2ac5a90088ed40960ac2ad.
    
    This reinstates it with the correct precedence.  The next commit
    will add an assert() so that the underlying issue will be detected
    on all platforms

M       regexec.c

commit 1aa9930eb1f2ea53c64cbde87e9406c6b4e08d52
Author: Karl Williamson <[email protected]>
Date:   Thu Mar 10 08:58:34 2011 -0700

    regcomp.c: call regclass_swash() only if non-empty
    
    We can tell if there is something outside the bitmap and so
    can short circuit calling this function if there isn't.

M       regcomp.c
-----------------------------------------------------------------------

Summary of changes:
 regcomp.c |    2 +-
 regexec.c |   13 ++++++++-----
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/regcomp.c b/regcomp.c
index b7a6939..0581217 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -11134,7 +11134,7 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const 
regnode *o)
        if (flags & ANYOF_NONBITMAP_NON_UTF8)
            sv_catpvs(sv, "{outside bitmap}");
 
-       {
+       if (ANYOF_NONBITMAP(o)) {
            SV *lv;
            SV * const sw = regclass_swash(prog, o, FALSE, &lv, 0);
        
diff --git a/regexec.c b/regexec.c
index 76784ee..69ddba5 100644
--- a/regexec.c
+++ b/regexec.c
@@ -6432,6 +6432,8 @@ Perl_regclass_swash(pTHX_ const regexp *prog, register 
const regnode* node, bool
 
     PERL_ARGS_ASSERT_REGCLASS_SWASH;
 
+    assert(ANYOF_NONBITMAP(node));
+
     if (data && data->count) {
        const U32 n = ARG(node);
 
@@ -6597,11 +6599,12 @@ S_reginclass(pTHX_ const regexp * const prog, register 
const regnode * const n,
        if (utf8_target && (flags & ANYOF_UNICODE_ALL) && c >= 256) {
            match = TRUE;       /* Everything above 255 matches */
        }
-       else if ((flags & ANYOF_NONBITMAP_NON_UTF8
-                 || (utf8_target && ANYOF_NONBITMAP(n)
-                     && (c >=256
-                         || (! (flags & ANYOF_LOCALE))
-                         || (flags & ANYOF_IS_SYNTHETIC)))))
+       else if (ANYOF_NONBITMAP(n)
+                && ((flags & ANYOF_NONBITMAP_NON_UTF8)
+                    || (utf8_target
+                        && (c >=256
+                            || (! (flags & ANYOF_LOCALE))
+                            || (flags & ANYOF_IS_SYNTHETIC)))))
        {
            AV *av;
            SV * const sw = regclass_swash(prog, n, TRUE, 0, (SV**)&av);

--
Perl5 Master Repository

Reply via email to