Revision: 800
http://www.exim.org/viewvc/pcre2?view=rev&revision=800
Author: ph10
Date: 2017-05-23 17:47:29 +0100 (Tue, 23 May 2017)
Log Message:
-----------
Fix potential NULL dereference in new code for surrogate escapes, discovered by
Coverity Scan.
Modified Paths:
--------------
code/trunk/src/pcre2_compile.c
Modified: code/trunk/src/pcre2_compile.c
===================================================================
--- code/trunk/src/pcre2_compile.c 2017-05-23 16:08:48 UTC (rev 799)
+++ code/trunk/src/pcre2_compile.c 2017-05-23 16:47:29 UTC (rev 800)
@@ -1667,8 +1667,8 @@
}
else if (ptr < ptrend && *ptr++ == CHAR_RIGHT_CURLY_BRACKET)
{
- if (utf && c >= 0xd800 && c <= 0xdfff &&
- (cb->cx->extra_options & PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES) == 0)
+ if (utf && c >= 0xd800 && c <= 0xdfff && (cb == NULL ||
+ (cb->cx->extra_options & PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES) == 0))
{
ptr--;
*errorcodeptr = ERR73;
@@ -1737,8 +1737,8 @@
}
else if (ptr < ptrend && *ptr++ == CHAR_RIGHT_CURLY_BRACKET)
{
- if (utf && c >= 0xd800 && c <= 0xdfff &&
- (cb->cx->extra_options & PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES) == 0)
+ if (utf && c >= 0xd800 && c <= 0xdfff && (cb == NULL ||
+ (cb->cx->extra_options & PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES) == 0))
{
ptr--;
*errorcodeptr = ERR73;