X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=pcre%2Fpcre.c;h=1e602df4399fe39bc6c7d8e99bb77fb72fa4367c;hp=5149f8dad7dc2ed1d423e3257dc47e2ea088e819;hb=777f23fd554b0811d16bc2323ced6fe9dc0cff72;hpb=c75584ebcc79f939fb4ec9c8f842cef6692640c7 diff --git a/pcre/pcre.c b/pcre/pcre.c index 5149f8da..1e602df4 100644 --- a/pcre/pcre.c +++ b/pcre/pcre.c @@ -2486,6 +2486,7 @@ const uschar *ptr; compile_data compile_block; int brastack[BRASTACK_SIZE]; uschar bralenstack[BRASTACK_SIZE]; +const size_t pattern_length = strlen(pattern); #ifdef DEBUG uschar *code_base, *code_end; @@ -3011,6 +3012,17 @@ while ((c = *(++ptr)) != 0) /* Ordinary character or single-char escape */ runlength++; + + if ((const char *)ptr > pattern + pattern_length) + { + *errorptr = "internal error"; + goto PCRE_ERROR_RETURN; + } + if ((int)ptr[1] >= tables_length - ctypes_offset) + { + *errorptr = ERR6; + goto PCRE_ERROR_RETURN; + } } /* This "while" is the end of the "do" above. */