projects
/
privoxy.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c3eca0b
)
pcre: Fix invalid reads in internal and outdated pcre code
author
Fabian Keil
<fk@fabiankeil.de>
Sat, 16 Jan 2016 12:28:43 +0000
(12:28 +0000)
committer
Fabian Keil
<fk@fabiankeil.de>
Sat, 16 Jan 2016 12:28:43 +0000
(12:28 +0000)
pcre/pcre.c
patch
|
blob
|
history
diff --git
a/pcre/pcre.c
b/pcre/pcre.c
index
5149f8d
..
1297ed9
100644
(file)
--- 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];
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;
#ifdef DEBUG
uschar *code_base, *code_end;
@@
-3011,6
+3012,17
@@
while ((c = *(++ptr)) != 0)
/* Ordinary character or single-char escape */
runlength++;
/* Ordinary character or single-char escape */
runlength++;
+
+ if (ptr > pattern + pattern_length)
+ {
+ *errorptr = "internal error";
+ goto PCRE_ERROR_RETURN;
+ }
+ if (ptr[1] >= tables_length - ctypes_offset)
+ {
+ *errorptr = ERR6;
+ goto PCRE_ERROR_RETURN;
+ }
}
/* This "while" is the end of the "do" above. */
}
/* This "while" is the end of the "do" above. */