[pcre-dev] [Bug 2307] Start anchor in condition without no-p…

トップ ページ
このメッセージを削除
著者: admin
日付:  
To: pcre-dev
題目: [pcre-dev] [Bug 2307] Start anchor in condition without no-pattern erroneously causes automatic anchoring
https://bugs.exim.org/show_bug.cgi?id=2307

Philip Hazel <ph10@???> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED


--- Comment #1 from Philip Hazel <ph10@???> ---
Hi John, I'm pottering along, thank you. Thanks for the bug report. It turns
out to be a bug in the 10.xx PCRE2 series as well. When testing for anchoring,
a missing second branch in a condition was being ignored - of course it should
be "not anchored". Luckily it is a small patch, only 1 line for PCRE2, but this
slightly larger one for PCRE1 8.42. I haven't thought about when to release
8.43 yet. The 8.xx series (as I'm sure you know) is obsolescent and I'm only
fixing straightforward bugs now.

Index: pcre_compile.c
===================================================================
--- pcre_compile.c      (revision 1738)
+++ pcre_compile.c      (working copy)
@@ -8682,13 +8682,21 @@
      if (!is_anchored(scode, new_map, cd, atomcount)) return FALSE;
      }


- /* Positive forward assertions and conditions */
+ /* Positive forward assertion */

-   else if (op == OP_ASSERT || op == OP_COND)
+   else if (op == OP_ASSERT)
      {
      if (!is_anchored(scode, bracket_map, cd, atomcount)) return FALSE;
      }


+   /* Condition; not anchored if no second branch */
+
+   else if (op == OP_COND)
+     {
+     if (scode[GET(scode,1)] != OP_ALT) return FALSE;
+     if (!is_anchored(scode, bracket_map, cd, atomcount)) return FALSE;
+     }
+
    /* Atomic groups */


    else if (op == OP_ONCE || op == OP_ONCE_NC)


--
You are receiving this mail because:
You are on the CC list for the bug.