Revision: 1760
http://vcs.pcre.org/viewvc?view=rev&revision=1760
Author: ph10
Date: 2020-02-10 17:01:27 +0000 (Mon, 10 Feb 2020)
Log Message:
-----------
Minor fix to avoid sanitizer complaint in POSIX wrapper.
Modified Paths:
--------------
code/trunk/ChangeLog
code/trunk/pcreposix.c
Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog 2020-02-10 16:45:25 UTC (rev 1759)
+++ code/trunk/ChangeLog 2020-02-10 17:01:27 UTC (rev 1760)
@@ -23,7 +23,11 @@
4. Fix ARMv5 JIT improper handling of labels right after a constant pool.
+5. Small patch to pcreposix.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 8.43 23-February-2019
-----------------------------
Modified: code/trunk/pcreposix.c
===================================================================
--- code/trunk/pcreposix.c 2020-02-10 16:45:25 UTC (rev 1759)
+++ code/trunk/pcreposix.c 2020-02-10 17:01:27 UTC (rev 1760)
@@ -6,7 +6,7 @@
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
- Copyright (c) 1997-2018 University of Cambridge
+ Copyright (c) 1997-2020 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -298,6 +298,7 @@
(void)pcre_fullinfo((const pcre *)preg->re_pcre, NULL, PCRE_INFO_CAPTURECOUNT,
&re_nsub);
preg->re_nsub = (size_t)re_nsub;
+preg->re_erroffset = (size_t)(-1); /* No meaning after successful compile */
return 0;
}
@@ -335,8 +336,6 @@
if ((eflags & REG_NOTEOL) != 0) options |= PCRE_NOTEOL;
if ((eflags & REG_NOTEMPTY) != 0) options |= PCRE_NOTEMPTY;
-((regex_t *)preg)->re_erroffset = (size_t)(-1); /* Only has meaning after compile */
-
/* When no string data is being returned, or no vector has been passed in which
to put it, ensure that nmatch is zero. Otherwise, ensure the vector for holding
the return data is large enough. */