[Pcre-svn] [392] code/trunk: Fix spurious error in pcre2test…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [392] code/trunk: Fix spurious error in pcre2test when single-letter modifiers at the end of a line have trailing spaces.
Revision: 392
          http://www.exim.org/viewvc/pcre2?view=rev&revision=392
Author:   ph10
Date:     2015-10-22 16:49:54 +0100 (Thu, 22 Oct 2015)
Log Message:
-----------
Fix spurious error in pcre2test when single-letter modifiers at the end of a line have trailing spaces.


Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/src/pcre2test.c


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2015-10-21 15:59:45 UTC (rev 391)
+++ code/trunk/ChangeLog    2015-10-22 15:49:54 UTC (rev 392)
@@ -210,7 +210,10 @@
 errors or other strange effects if compiled in UCP mode. Found with libFuzzer
 and AddressSanitizer.


+61. Whitespace at the end of a pcre2test pattern line caused a spurious error
+message if there were only single-character modifiers. It should be ignored.

+
Version 10.20 30-June-2015
--------------------------


Modified: code/trunk/src/pcre2test.c
===================================================================
--- code/trunk/src/pcre2test.c    2015-10-21 15:59:45 UTC (rev 391)
+++ code/trunk/src/pcre2test.c    2015-10-22 15:49:54 UTC (rev 392)
@@ -3111,7 +3111,11 @@
   /* Find the end of the item; lose trailing whitespace at end of line. */


   for (ep = p; *ep != 0 && *ep != ','; ep++);
-  if (*ep == 0) while (ep > p && isspace(ep[-1])) ep--;
+  if (*ep == 0) 
+    {
+    while (ep > p && isspace(ep[-1])) ep--;
+    *ep = 0;
+    }  


/* Remember if the first character is '-'. */