[pcre-dev] pcre2_jit_match(): match context needed?

Top Pagina
Delete this message
Auteur: Ralf Junker
Datum:  
Aan: pcre-dev@exim.org
Onderwerp: [pcre-dev] pcre2_jit_match(): match context needed?
PCRE2 pcre2jit.html:

"The fast path function is called pcre2_jit_match(), and it takes
exactly the same arguments as pcre2_match()."

From this I concluded that I can use pcre2_jit_match() exactly as
pcre2_match(), provided that I previously called pcre2_jit_compile().

I hence called pcre2_jit_match() without providing a match context. As a
result, I received an AV.

Creating a match context and passing it to pcre2_jit_match() solved the
problem.

I wondered if pcre2_jit_match() indeed needs a match context, but the
"JIT FAST PATH API" section does not mention it.

pcre2_jit_match.c is not clear either: line 136 tests "if (mcontext !=
NULL)" whereas line 159 de-references mcontext without prior testing -
which leads to the AV described above.

If pcre2_jit_match() indeed needs a match context, should it not return
an error if missing (i.e. PCRE2_ERROR_JIT_BADOPTION) instead of raising
an AV?

Ralf