[Pcre-svn] [797] code/trunk/src/pcre2_fuzzsupport.c: Screw d…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [797] code/trunk/src/pcre2_fuzzsupport.c: Screw down the depth limit for DFA matching in the fuzzer function.
Revision: 797
          http://www.exim.org/viewvc/pcre2?view=rev&revision=797
Author:   ph10
Date:     2017-05-22 19:06:55 +0100 (Mon, 22 May 2017)
Log Message:
-----------
Screw down the depth limit for DFA matching in the fuzzer function. Fixes 
OSS-fuzz 1761 (I hope).


Modified Paths:
--------------
    code/trunk/src/pcre2_fuzzsupport.c


Modified: code/trunk/src/pcre2_fuzzsupport.c
===================================================================
--- code/trunk/src/pcre2_fuzzsupport.c    2017-05-22 10:23:36 UTC (rev 796)
+++ code/trunk/src/pcre2_fuzzsupport.c    2017-05-22 18:06:55 UTC (rev 797)
@@ -172,12 +172,13 @@
         return 0;
         }
       (void)pcre2_set_match_limit(match_context, 100);
-      (void)pcre2_set_depth_limit(match_context, 100);
       (void)pcre2_set_callout(match_context, callout_function, &callout_count);
       }


-    /* Match twice, with and without options */
+    /* Match twice, with and without options, with a depth limit of 100. */


+    (void)pcre2_set_depth_limit(match_context, 100);
+
     for (j = 0; j < 2; j++)
       {
 #ifdef STANDALONE
@@ -210,9 +211,11 @@
       match_options = 0;  /* For second time */
       }


-    /* Match with DFA twice, with and without options */
+    /* Match with DFA twice, with and without options, depth limit of 10. */


-    match_options = save_match_options & ~PCRE2_NO_JIT;
+    (void)pcre2_set_depth_limit(match_context, 10);
+    match_options = save_match_options & ~PCRE2_NO_JIT;  /* Not valid for DFA */
+
     for (j = 0; j < 2; j++)
       {
 #ifdef STANDALONE