[Pcre-svn] [694] code/trunk: Fix NULL deference if pcre2_ca…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [694] code/trunk: Fix NULL deference if pcre2_callout_enumerate() is called with a NULL pattern
Revision: 694
          http://www.exim.org/viewvc/pcre2?view=rev&revision=694
Author:   ph10
Date:     2017-03-21 16:31:54 +0000 (Tue, 21 Mar 2017)
Log Message:
-----------
Fix NULL deference if pcre2_callout_enumerate() is called with a NULL pattern 
when Unicode support is available (Bugzilla 2076).


Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/src/pcre2_pattern_info.c


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2017-03-21 16:25:01 UTC (rev 693)
+++ code/trunk/ChangeLog    2017-03-21 16:31:54 UTC (rev 694)
@@ -73,7 +73,10 @@


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
------------------------------


Modified: code/trunk/src/pcre2_pattern_info.c
===================================================================
--- code/trunk/src/pcre2_pattern_info.c    2017-03-21 16:25:01 UTC (rev 693)
+++ code/trunk/src/pcre2_pattern_info.c    2017-03-21 16:31:54 UTC (rev 694)
@@ -261,11 +261,15 @@
 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. */