Revision: 432
http://www.exim.org/viewvc/pcre2?view=rev&revision=432
Author: ph10
Date: 2015-11-13 17:26:42 +0000 (Fri, 13 Nov 2015)
Log Message:
-----------
Paranoid check in regcomp() for bad error code from pcre2_compile().
Modified Paths:
--------------
code/trunk/ChangeLog
code/trunk/src/pcre2posix.c
Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog 2015-11-13 17:16:28 UTC (rev 431)
+++ code/trunk/ChangeLog 2015-11-13 17:26:42 UTC (rev 432)
@@ -299,7 +299,9 @@
88. In pcre2_substitute(), ensure that CRLF is not split when it is a valid
newline sequence.
+89. Paranoid check in regcomp() for bad error code from pcre2_compile().
+
Version 10.20 30-June-2015
--------------------------
Modified: code/trunk/src/pcre2posix.c
===================================================================
--- code/trunk/src/pcre2posix.c 2015-11-13 17:16:28 UTC (rev 431)
+++ code/trunk/src/pcre2posix.c 2015-11-13 17:26:42 UTC (rev 432)
@@ -217,8 +217,13 @@
if (preg->re_pcre2_code == NULL)
{
unsigned int i;
- if (errorcode < 0) return REG_BADPAT; /* UTF error */
+
+ /* A negative value is a UTF error; otherwise all error codes are greater
+ than COMPILE_ERROR_BASE, but check, just in case. */
+
+ if (errorcode < COMPILE_ERROR_BASE) return REG_BADPAT;
errorcode -= COMPILE_ERROR_BASE;
+
if (errorcode < (int)(sizeof(eint1)/sizeof(const int)))
return eint1[errorcode];
for (i = 0; i < sizeof(eint2)/(2*sizeof(const int)); i += 2)