]> granicus.if.org Git - php/commitdiff
Compile the blacklist pattern with JIT
authorAnatol Belski <ab@php.net>
Tue, 19 Dec 2017 11:51:38 +0000 (12:51 +0100)
committerAnatol Belski <ab@php.net>
Tue, 19 Dec 2017 11:57:39 +0000 (12:57 +0100)
There are certain limitations on the pattern size. Should the JIT
compilation fail, the interpreter code is still usable.

ext/opcache/zend_accelerator_blacklist.c

index 46d50cf96dd1447037faafa69f2a4436334a51bb..8b8c9b0d3752f8bd450b51c334d4b649e8b62944 100644 (file)
@@ -184,6 +184,13 @@ static void zend_accel_blacklist_update_regexp(zend_blacklist *blacklist)
                                blacklist_report_regexp_error((char *)pcre_error, pcre_error_offset);
                                return;
                        }
+#ifdef HAVE_PCRE_JIT_SUPPORT
+                       if (0 > pcre2_jit_compile(it->re, PCRE2_JIT_COMPLETE)) {
+                               /* Don't return here, even JIT could fail to compile, the pattern is still usable. */
+                               pcre2_get_error_message(errnumber, pcre_error, sizeof(pcre_error));
+                               zend_accel_error(ACCEL_LOG_WARNING, "Blacklist JIT compilation failed, %s\n", pcre_error);
+                       }
+#endif
                        /* prepare for the next iteration */
                        p = regexp + 2;
                        *regexp_list_it = it;