[pcre-dev] [Bug 2190] pcre2_substitute will always return P…

Startseite
Nachricht löschen
Autor: admin
Datum:  
To: pcre-dev
Alte Treads: [pcre-dev] [Bug 2190] New: This will always return PCRE2_ERROR_NOMEMORY if match_data and mcontext both are NULL
Betreff: [pcre-dev] [Bug 2190] pcre2_substitute will always return PCRE2_ERROR_NOMEMORY if match_data and mcontext both are NULL
https://bugs.exim.org/show_bug.cgi?id=2190

Philip Hazel <ph10@???> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED


--- Comment #1 from Philip Hazel <ph10@???> ---
Thank you for taking time to look at the code. I'm afraid, however, that you
are wrong. Or at least, partly wrong. :-) Yes, gcontext does indeed get set to
code, but what is happening here is that we are going to use the same memory
allocator for the match_data as was used for the code if there is no match
context. Otherwise use the memory allocator from the match context. All these
data blocks (defined in pcre2_indmodep.h) start with a memory allocator, as
does a general context (indeed, that's *all* a general context contains). So
this code is creating a new match data block by calling
pcre2_match_data_create(). If the result of this function is NULL, it means the
memory allocation failed, so the resulting error is correct. Note that gcontext
is local to this small block of code.

Your final suggestion is a rather long-winded way of saying gcontext =
mcontext, incidentally.

--
You are receiving this mail because:
You are on the CC list for the bug.