summaryrefslogtreecommitdiff
path: root/pcre_compile.c
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2015-08-10 14:38:34 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2015-08-10 14:38:34 +0000
commitbfd7c7922a090ab24efc1214ff827e6c4ccf5419 (patch)
treed3fcacae00d7c6a08bbf5426b4159fd9928d733c /pcre_compile.c
parentb35246ac4badf9c2a99b21b214998361babd7afb (diff)
downloadpcre-bfd7c7922a090ab24efc1214ff827e6c4ccf5419.tar.gz
Add an internal error if handling forward referencing recursion calls has gone
wrong. git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1590 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'pcre_compile.c')
-rw-r--r--pcre_compile.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/pcre_compile.c b/pcre_compile.c
index 09c8759..3d3b1cc 100644
--- a/pcre_compile.c
+++ b/pcre_compile.c
@@ -464,7 +464,7 @@ static const char error_texts[] =
"range out of order in character class\0"
"nothing to repeat\0"
/* 10 */
- "operand of unlimited repeat could match the empty string\0" /** DEAD **/
+ "internal error: invalid forward reference offset\0"
"internal error: unexpected repeat\0"
"unrecognized character after (? or (?-\0"
"POSIX named classes are supported only within a class\0"
@@ -9434,6 +9434,16 @@ if (cd->hwm > cd->start_workspace)
int offset, recno;
cd->hwm -= LINK_SIZE;
offset = GET(cd->hwm, 0);
+
+ /* Check that the hwm handling hasn't gone wrong. This whole area is
+ rewritten in PCRE2 because there are some obscure cases. */
+
+ if (offset == 0 || codestart[offset-1] != OP_RECURSE)
+ {
+ errorcode = ERR10;
+ break;
+ }
+
recno = GET(codestart, offset);
if (recno != prev_recno)
{