[Pcre-svn] [420] code/trunk: Allow for the possibility of th…

Inizio della pagina
Delete this message
Autore: Subversion repository
Data:  
To: pcre-svn
Oggetto: [Pcre-svn] [420] code/trunk: Allow for the possibility of the size of the nest_save structure not being
Revision: 420
          http://www.exim.org/viewvc/pcre2?view=rev&revision=420
Author:   ph10
Date:     2015-11-09 17:39:43 +0000 (Mon, 09 Nov 2015)
Log Message:
-----------
Allow for the possibility of the size of the nest_save structure not being
a factor of the size of the compiling workspace.


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


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2015-11-09 17:09:00 UTC (rev 419)
+++ code/trunk/ChangeLog    2015-11-09 17:39:43 UTC (rev 420)
@@ -272,7 +272,10 @@
 checking whether a group has a fixed length and/or could match an empty string, 
 especially when recursion or subroutine calls are involved.


+80. Allow for the possibility of the size of the nest_save structure not being
+a factor of the size of the compiling workspace (it currently is).

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


Modified: code/trunk/src/pcre2_compile.c
===================================================================
--- code/trunk/src/pcre2_compile.c    2015-11-09 17:09:00 UTC (rev 419)
+++ code/trunk/src/pcre2_compile.c    2015-11-09 17:39:43 UTC (rev 420)
@@ -3149,6 +3149,15 @@
 nest_save *top_nest = NULL;
 nest_save *end_nests = (nest_save *)(cb->start_workspace + cb->workspace_size);


+/* The size of the nest_save structure might not be a factor of the size of the
+workspace. Therefore we must round down end_nests so as to correctly avoid
+creating a nest_save that spans the end of the workspace. */
+
+end_nests = (nest_save *)((char *)end_nests -
+ ((cb->workspace_size * sizeof(PCRE2_UCHAR)) % sizeof(nest_save)));
+
+/* Now scan the pattern */
+
for (; ptr < cb->end_pattern; ptr++)
{
c = *ptr;