From f374ff2cc7427024c1bba306303b70eec1541138 Mon Sep 17 00:00:00 2001 From: zherczeg Date: Thu, 23 Nov 2017 07:54:39 +0000 Subject: [PATCH] Fix pcre2_jit_match early check. --- ChangeLog | 5 +++++ src/pcre2_jit_match.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 99bb834..f6de46d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -55,6 +55,11 @@ All these issues should now be fixed. compressed file (.gz or .bz2) a segfault occurred. (Line buffering should be ignored for compressed files.) +15. Although pcre2_jit_match checks whether the pattern is compiled +in a given mode, it was also expected that at least one mode is available. +This is fixed and pcre2_jit_match returns with PCRE2_ERROR_JIT_BADOPTION +when the pattern is not optimized by JIT at all. + Version 10.30 14-August-2017 ---------------------------- diff --git a/src/pcre2_jit_match.c b/src/pcre2_jit_match.c index 4cad754..2f840ab 100644 --- a/src/pcre2_jit_match.c +++ b/src/pcre2_jit_match.c @@ -118,7 +118,7 @@ if ((options & PCRE2_PARTIAL_HARD) != 0) else if ((options & PCRE2_PARTIAL_SOFT) != 0) index = 1; -if (functions->executable_funcs[index] == NULL) +if (functions->executable_funcs == NULL || functions->executable_funcs[index] == NULL) return PCRE2_ERROR_JIT_BADOPTION; /* Sanity checks should be handled by pcre_exec. */