Ensure regexec is thread safe to avoid sanitizer warnings.
This commit is contained in:
parent
97acc05f0c
commit
2a0faa2114
|
@ -170,6 +170,10 @@ value (because the search for a "required" code unit starts at the match start
|
|||
for non-unique first code unit patterns, but after a unique first code unit,
|
||||
and patterns such as a*a need the former action).
|
||||
|
||||
36. Small patch to pcre2posix.c to set the erroroffset field to -1 immediately
|
||||
after a successful compile, instead of at the start of matching to avoid a
|
||||
sanitizer complaint (regexec is supposed to be thread safe).
|
||||
|
||||
|
||||
Version 10.33 16-April-2019
|
||||
---------------------------
|
||||
|
|
|
@ -323,6 +323,7 @@ if (preg->re_pcre2_code == NULL)
|
|||
PCRE2_INFO_CAPTURECOUNT, &re_nsub);
|
||||
preg->re_nsub = (size_t)re_nsub;
|
||||
preg->re_match_data = pcre2_match_data_create(re_nsub + 1, NULL);
|
||||
preg->re_erroffset = (size_t)(-1); /* No meaning after successful compile */
|
||||
|
||||
if (preg->re_match_data == NULL)
|
||||
{
|
||||
|
@ -356,8 +357,6 @@ if ((eflags & REG_NOTBOL) != 0) options |= PCRE2_NOTBOL;
|
|||
if ((eflags & REG_NOTEOL) != 0) options |= PCRE2_NOTEOL;
|
||||
if ((eflags & REG_NOTEMPTY) != 0) options |= PCRE2_NOTEMPTY;
|
||||
|
||||
((regex_t *)preg)->re_erroffset = (size_t)(-1); /* Only has meaning after compile */
|
||||
|
||||
/* When REG_NOSUB was specified, or if no vector has been passed in which to
|
||||
put captured strings, ensure that nmatch is zero. This will stop any attempt to
|
||||
write to pmatch. */
|
||||
|
|
Loading…
Reference in New Issue