[Pcre-svn] [648] code/trunk: Fix bug that caused /.(*F)/ to …

トップ ページ
このメッセージを削除
著者: Subversion repository
日付:  
To: pcre-svn
題目: [Pcre-svn] [648] code/trunk: Fix bug that caused /.(*F)/ to give a partial match instead of no match.
Revision: 648
          http://vcs.pcre.org/viewvc?view=rev&revision=648
Author:   ph10
Date:     2011-08-01 12:02:08 +0100 (Mon, 01 Aug 2011)


Log Message:
-----------
Fix bug that caused /.(*F)/ to give a partial match instead of no match.

Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/pcre_exec.c
    code/trunk/testdata/testinput2
    code/trunk/testdata/testoutput2


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2011-08-01 10:22:59 UTC (rev 647)
+++ code/trunk/ChangeLog    2011-08-01 11:02:08 UTC (rev 648)
@@ -237,7 +237,11 @@


44. Add a pointer to the latest mark to the callout data block.

+45. The pattern /.(*F)/, when applied to "abc" with PCRE_PARTIAL_HARD, gave a
+    partial match of an empty string instead of no match. This was specific to
+    the use of ".".


+
Version 8.12 15-Jan-2011
------------------------


Modified: code/trunk/pcre_exec.c
===================================================================
--- code/trunk/pcre_exec.c    2011-08-01 10:22:59 UTC (rev 647)
+++ code/trunk/pcre_exec.c    2011-08-01 11:02:08 UTC (rev 648)
@@ -2014,11 +2014,12 @@
     /* Fall through */


     case OP_ALLANY:
-    if (eptr++ >= md->end_subject)
-      {
+    if (eptr >= md->end_subject)   /* DO NOT merge the eptr++ here; it must */
+      {                            /* not be updated before SCHECK_PARTIAL. */
       SCHECK_PARTIAL();
       MRRETURN(MATCH_NOMATCH);
       }
+    eptr++;
     if (utf8) while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
     ecode++;
     break;
@@ -2027,11 +2028,12 @@
     any byte, even newline, independent of the setting of PCRE_DOTALL. */


     case OP_ANYBYTE:
-    if (eptr++ >= md->end_subject)
-      {
+    if (eptr >= md->end_subject)   /* DO NOT merge the eptr++ here; it must */
+      {                            /* not be updated before SCHECK_PARTIAL. */
       SCHECK_PARTIAL();
       MRRETURN(MATCH_NOMATCH);
       }
+    eptr++;   
     ecode++;
     break;



Modified: code/trunk/testdata/testinput2
===================================================================
--- code/trunk/testdata/testinput2    2011-08-01 10:22:59 UTC (rev 647)
+++ code/trunk/testdata/testinput2    2011-08-01 11:02:08 UTC (rev 648)
@@ -3834,4 +3834,7 @@
     aez
     aeqwerty


+/.(*F)/
+    \P\Pabc
+
 /-- End of testinput2 --/


Modified: code/trunk/testdata/testoutput2
===================================================================
--- code/trunk/testdata/testoutput2    2011-08-01 10:22:59 UTC (rev 647)
+++ code/trunk/testdata/testoutput2    2011-08-01 11:02:08 UTC (rev 648)
@@ -12213,4 +12213,8 @@
  0: aeq
  1: aeq


+/.(*F)/
+    \P\Pabc
+No match
+
 /-- End of testinput2 --/