aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2003-03-21 10:36:08 +0000
committernyamatongwe <devnull@localhost>2003-03-21 10:36:08 +0000
commit4cc47ffee150294207350b81cea0c49fe1b5c250 (patch)
tree3fc20520b7aada6e4f53fa6a5b04bcb45651ab37 /src
parentd4849b34e7c561921671603232668ca0c4b41b69 (diff)
downloadscintilla-mirror-4cc47ffee150294207350b81cea0c49fe1b5c250.tar.gz
Detect patterns too long in regular expression search.
Diffstat (limited to 'src')
-rw-r--r--src/RESearch.cxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/RESearch.cxx b/src/RESearch.cxx
index 430a65e1f..e19d160f5 100644
--- a/src/RESearch.cxx
+++ b/src/RESearch.cxx
@@ -30,6 +30,9 @@
* Modification history:
*
* $Log$
+ * Revision 1.9 2003/03/21 10:36:08 nyamatongwe
+ * Detect patterns too long in regular expression search.
+ *
* Revision 1.8 2003/03/04 10:53:59 nyamatongwe
* Patch from Jakub to optionally implement more POSIX compatible regular
* expressions. \(..\) changes to (..)
@@ -345,6 +348,7 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
char *mp=nfa; /* nfa pointer */
char *lp; /* saved pointer.. */
char *sp=nfa; /* another one.. */
+ char *mpMax = mp + MAXNFA - BITBLK - 10;
int tagi = 0; /* tag stack index */
int tagc = 1; /* actual tag count */
@@ -362,6 +366,8 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
const char *p=pat; /* pattern pointer */
for (int i=0; i<length; i++, p++) {
+ if (mp > mpMax)
+ return badpat("Pattern too long");
lp = mp;
switch(*p) {