[Pcre-svn] [1515] code/trunk: Fix pcretest crash with /g and…

トップ ページ
このメッセージを削除
著者: Subversion repository
日付:  
To: pcre-svn
題目: [Pcre-svn] [1515] code/trunk: Fix pcretest crash with /g and zero-length ovector.
Revision: 1515
          http://vcs.pcre.org/viewvc?view=rev&revision=1515
Author:   ph10
Date:     2015-02-03 17:08:54 +0000 (Tue, 03 Feb 2015)


Log Message:
-----------
Fix pcretest crash with /g and zero-length ovector.

Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/pcretest.c


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2015-02-03 14:34:44 UTC (rev 1514)
+++ code/trunk/ChangeLog    2015-02-03 17:08:54 UTC (rev 1515)
@@ -16,6 +16,9 @@


 3.  If a pattern in pcretest input had the P (POSIX) modifier followed by an
     unrecognized modifier, a crash could occur. 
+    
+4.  An attempt to do global matching in pcretest with a zero-length ovector
+    caused a crash. 





Modified: code/trunk/pcretest.c
===================================================================
--- code/trunk/pcretest.c    2015-02-03 14:34:44 UTC (rev 1514)
+++ code/trunk/pcretest.c    2015-02-03 17:08:54 UTC (rev 1515)
@@ -5603,6 +5603,12 @@
       /* If not /g or /G we are done */


       if (!do_g && !do_G) break;
+      
+      if (use_offsets == NULL)
+        {
+        fprintf(outfile, "Cannot do global matching without an ovector\n");
+        break;
+        }    


       /* If we have matched an empty string, first check to see if we are at
       the end of the subject. If so, the /g loop is over. Otherwise, mimic what