Fix NULL deference if pcre2_callout_enumerate() is called with a NULL pattern

when Unicode support is available (Bugzilla 2076).
This commit is contained in:
Philip.Hazel 2017-03-21 16:31:54 +00:00
parent e105a0f83f
commit a122f42abf
2 changed files with 8 additions and 1 deletions

View File

@ -73,6 +73,9 @@ or deserialization (the "load" or "save" commands).
11. Fix memory leak in pcre2_serialize_decode() when the input is invalid.
12. Fix potential NULL dereference in pcre2_callout_enumerate() if called with
a NULL pattern pointer when Unicode support is available.
Version 10.23 14-February-2017
------------------------------

View File

@ -261,11 +261,15 @@ pcre2_real_code *re = (pcre2_real_code *)code;
pcre2_callout_enumerate_block cb;
PCRE2_SPTR cc;
#ifdef SUPPORT_UNICODE
BOOL utf = (re->overall_options & PCRE2_UTF) != 0;
BOOL utf;
#endif
if (re == NULL) return PCRE2_ERROR_NULL;
#ifdef SUPPORT_UNICODE
utf = (re->overall_options & PCRE2_UTF) != 0;
#endif
/* Check that the first field in the block is the magic number. If it is not,
return with PCRE2_ERROR_BADMAGIC. */