summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBilly Donahue <billy.donahue@mongodb.com>2020-05-11 18:33:32 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-05-12 23:59:46 +0000
commitcb3f49285f8a5663244f94d89e56c2f28f7ae685 (patch)
treedbf7321f6da8dc0415d780cd766fac835e02d062
parent2a599c879c0775773ac4f67ef148a0838a5e9898 (diff)
downloadmongo-cb3f49285f8a5663244f94d89e56c2f28f7ae685.tar.gz
SERVER-48116 fix init-order bug in pcrecpp::RE::Init
-rw-r--r--src/third_party/pcre-8.42/patches/0002-SERVER-48116-fix-init-order-bug-in-pcrecpp-RE-Init.patch34
-rw-r--r--src/third_party/pcre-8.42/pcrecpp.cc4
2 files changed, 35 insertions, 3 deletions
diff --git a/src/third_party/pcre-8.42/patches/0002-SERVER-48116-fix-init-order-bug-in-pcrecpp-RE-Init.patch b/src/third_party/pcre-8.42/patches/0002-SERVER-48116-fix-init-order-bug-in-pcrecpp-RE-Init.patch
new file mode 100644
index 00000000000..66aab751b79
--- /dev/null
+++ b/src/third_party/pcre-8.42/patches/0002-SERVER-48116-fix-init-order-bug-in-pcrecpp-RE-Init.patch
@@ -0,0 +1,34 @@
+From 62877f15fcaf81eed85da5a7f11363d103a0b940 Mon Sep 17 00:00:00 2001
+From: Billy Donahue <billy.donahue@mongodb.com>
+Date: Mon, 11 May 2020 18:33:32 -0400
+Subject: [PATCH] SERVER-48116 fix init-order bug in pcrecpp::RE::Init
+
+---
+ src/third_party/pcre-8.42/pcrecpp.cc | 4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+diff --git a/src/third_party/pcre-8.42/pcrecpp.cc b/src/third_party/pcre-8.42/pcrecpp.cc
+index 1147d01108..f37e3ed7c4 100644
+--- a/src/third_party/pcre-8.42/pcrecpp.cc
++++ b/src/third_party/pcre-8.42/pcrecpp.cc
+@@ -77,9 +77,6 @@ extern Arg no_arg
+ // If a regular expression has no error, its error_ field points here
+ static const string empty_string;
+
+-// If the user doesn't ask for any options, we just use this one
+-static RE_Options default_options;
+-
+ // Specials for the start of patterns. See comments where start_options is used
+ // below. (PH June 2018)
+ static const char *start_options[] = {
+@@ -102,6 +99,7 @@ static const char *start_options[] = {
+ void RE::Init(const string& pat, const RE_Options* options) {
+ pattern_ = pat;
+ if (options == NULL) {
++ static const RE_Options& default_options = *new RE_Options();
+ options_ = default_options;
+ } else {
+ options_ = *options;
+--
+2.17.1
+
diff --git a/src/third_party/pcre-8.42/pcrecpp.cc b/src/third_party/pcre-8.42/pcrecpp.cc
index 1147d01108a..f37e3ed7c44 100644
--- a/src/third_party/pcre-8.42/pcrecpp.cc
+++ b/src/third_party/pcre-8.42/pcrecpp.cc
@@ -77,9 +77,6 @@ extern Arg no_arg
// If a regular expression has no error, its error_ field points here
static const string empty_string;
-// If the user doesn't ask for any options, we just use this one
-static RE_Options default_options;
-
// Specials for the start of patterns. See comments where start_options is used
// below. (PH June 2018)
static const char *start_options[] = {
@@ -102,6 +99,7 @@ static const char *start_options[] = {
void RE::Init(const string& pat, const RE_Options* options) {
pattern_ = pat;
if (options == NULL) {
+ static const RE_Options& default_options = *new RE_Options();
options_ = default_options;
} else {
options_ = *options;