Revision: 1189
http://vcs.pcre.org/viewvc?view=rev&revision=1189
Author: ph10
Date: 2012-10-30 16:34:17 +0000 (Tue, 30 Oct 2012)
Log Message:
-----------
Add PCRE_ERROR_BADLENGTH for a negative length.
Modified Paths:
--------------
code/trunk/pcre.h.in
code/trunk/pcre_dfa_exec.c
code/trunk/pcre_exec.c
code/trunk/pcretest.c
Modified: code/trunk/pcre.h.in
===================================================================
--- code/trunk/pcre.h.in 2012-10-29 16:25:25 UTC (rev 1188)
+++ code/trunk/pcre.h.in 2012-10-30 16:34:17 UTC (rev 1189)
@@ -184,6 +184,7 @@
#define PCRE_ERROR_BADENDIANNESS (-29)
#define PCRE_ERROR_DFA_BADRESTART (-30)
#define PCRE_ERROR_JIT_BADOPTION (-31)
+#define PCRE_ERROR_BADLENGTH (-32)
/* Specific error codes for UTF-8 validity checks */
Modified: code/trunk/pcre_dfa_exec.c
===================================================================
--- code/trunk/pcre_dfa_exec.c 2012-10-29 16:25:25 UTC (rev 1188)
+++ code/trunk/pcre_dfa_exec.c 2012-10-30 16:34:17 UTC (rev 1189)
@@ -3122,6 +3122,7 @@
(offsets == NULL && offsetcount > 0)) return PCRE_ERROR_NULL;
if (offsetcount < 0) return PCRE_ERROR_BADCOUNT;
if (wscount < 20) return PCRE_ERROR_DFA_WSSIZE;
+if (length < 0) return PCRE_ERROR_BADLENGTH;
if (start_offset < 0 || start_offset > length) return PCRE_ERROR_BADOFFSET;
/* Check that the first field in the block is the magic number. If it is not,
Modified: code/trunk/pcre_exec.c
===================================================================
--- code/trunk/pcre_exec.c 2012-10-29 16:25:25 UTC (rev 1188)
+++ code/trunk/pcre_exec.c 2012-10-30 16:34:17 UTC (rev 1189)
@@ -6295,6 +6295,7 @@
if (re == NULL || subject == NULL || (offsets == NULL && offsetcount > 0))
return PCRE_ERROR_NULL;
if (offsetcount < 0) return PCRE_ERROR_BADCOUNT;
+if (length < 0) return PCRE_ERROR_BADLENGTH;
if (start_offset < 0 || start_offset > length) return PCRE_ERROR_BADOFFSET;
/* Check that the first field in the block is the magic number. If it is not,
Modified: code/trunk/pcretest.c
===================================================================
--- code/trunk/pcretest.c 2012-10-29 16:25:25 UTC (rev 1188)
+++ code/trunk/pcretest.c 2012-10-30 16:34:17 UTC (rev 1189)
@@ -1129,7 +1129,9 @@
"JIT stack limit reached",
"pattern compiled in wrong mode: 8-bit/16-bit error",
"pattern compiled with other endianness",
- "invalid data in workspace for DFA restart"
+ "invalid data in workspace for DFA restart",
+ "bad JIT option",
+ "bad length"
};