Allow for the possibility of the size of the nest_save structure not being

a factor of the size of the compiling workspace.
This commit is contained in:
Philip.Hazel 2015-11-09 17:39:43 +00:00
parent ddf5f0532b
commit 1bd3658bd9
2 changed files with 12 additions and 0 deletions

View File

@ -272,6 +272,9 @@ size of patterns that they are prepared to handle.
checking whether a group has a fixed length and/or could match an empty string, checking whether a group has a fixed length and/or could match an empty string,
especially when recursion or subroutine calls are involved. 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 Version 10.20 30-June-2015
-------------------------- --------------------------

View File

@ -3149,6 +3149,15 @@ named_group *ng;
nest_save *top_nest = NULL; nest_save *top_nest = NULL;
nest_save *end_nests = (nest_save *)(cb->start_workspace + cb->workspace_size); 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++) for (; ptr < cb->end_pattern; ptr++)
{ {
c = *ptr; c = *ptr;