summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEtienne Petrel <etienne.petrel@mongodb.com>2022-08-02 01:27:24 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-08-02 01:57:15 +0000
commit27c4d326ad61ffe9140127e368b348fbd32d9bca (patch)
tree93d4c5508210b033fa8a8153ff594b389b1a40e1 /src
parentc78a32d13ea7f8111d187b4ef9260e11ced7cb9a (diff)
downloadmongo-27c4d326ad61ffe9140127e368b348fbd32d9bca.tar.gz
Import wiredtiger: 73cf57f21c02e00d11ffec1801d499309579ae5f from branch mongodb-master
ref: f546c23734..73cf57f21c for: 6.1.0-rc0 WT-9646 Fix NULL pointer dereference in __wt_panic_func() (#8154)
Diffstat (limited to 'src')
-rw-r--r--src/third_party/wiredtiger/import.data2
-rw-r--r--src/third_party/wiredtiger/src/support/err.c41
2 files changed, 21 insertions, 22 deletions
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data
index 73b42c1eff4..973e9a40fb5 100644
--- a/src/third_party/wiredtiger/import.data
+++ b/src/third_party/wiredtiger/import.data
@@ -2,5 +2,5 @@
"vendor": "wiredtiger",
"github": "wiredtiger/wiredtiger.git",
"branch": "mongodb-master",
- "commit": "f546c2373464ac939116a4886d93360ffdf827df"
+ "commit": "73cf57f21c02e00d11ffec1801d499309579ae5f"
}
diff --git a/src/third_party/wiredtiger/src/support/err.c b/src/third_party/wiredtiger/src/support/err.c
index 869652ea75c..287a59b4c41 100644
--- a/src/third_party/wiredtiger/src/support/err.c
+++ b/src/third_party/wiredtiger/src/support/err.c
@@ -503,7 +503,13 @@ __wt_panic_func(WT_SESSION_IMPL *session, int error, const char *func, int line,
WT_CONNECTION_IMPL *conn;
va_list ap;
- conn = S2C(session);
+ /*
+ * !!!
+ * This function MUST handle a NULL WT_SESSION_IMPL handle.
+ *
+ * We will pedantically check the session and connection handles any time we use them.
+ */
+ conn = session != NULL ? S2C(session) : NULL;
/*
* Ignore error returns from underlying event handlers, we already have an error value to
@@ -511,17 +517,12 @@ __wt_panic_func(WT_SESSION_IMPL *session, int error, const char *func, int line,
*/
va_start(ap, fmt);
WT_IGNORE_RET(
- __eventv(session, session ? FLD_ISSET(conn->json_output, WT_JSON_OUTPUT_ERROR) : false, error,
- func, line, category, WT_VERBOSE_ERROR, fmt, ap));
+ __eventv(session, conn != NULL ? FLD_ISSET(conn->json_output, WT_JSON_OUTPUT_ERROR) : false,
+ error, func, line, category, WT_VERBOSE_ERROR, fmt, ap));
va_end(ap);
- /*
- * !!!
- * This function MUST handle a NULL WT_SESSION_IMPL handle.
- *
- * If the connection has already panicked, just return the error.
- */
- if (session != NULL && F_ISSET(conn, WT_CONN_PANIC))
+ /* If the connection has already panicked, just return the error. */
+ if (conn != NULL && F_ISSET(conn, WT_CONN_PANIC))
return (WT_PANIC);
/*
@@ -531,8 +532,9 @@ __wt_panic_func(WT_SESSION_IMPL *session, int error, const char *func, int line,
* I'm not confident of underlying support for a NULL.
*/
va_start(ap, fmt);
- WT_IGNORE_RET(__eventv(session, FLD_ISSET(conn->json_output, WT_JSON_OUTPUT_ERROR), WT_PANIC,
- func, line, category, WT_VERBOSE_ERROR, "the process must exit and restart", ap));
+ WT_IGNORE_RET(
+ __eventv(session, conn != NULL ? FLD_ISSET(conn->json_output, WT_JSON_OUTPUT_ERROR) : false,
+ WT_PANIC, func, line, category, WT_VERBOSE_ERROR, "the process must exit and restart", ap));
va_end(ap);
#if defined(HAVE_DIAGNOSTIC)
@@ -545,17 +547,14 @@ __wt_panic_func(WT_SESSION_IMPL *session, int error, const char *func, int line,
* Hence in the diagnostic mode, the application can set the debug flag to choose between
* dropping a core and returning an error.
*/
- if (!F_ISSET(conn, WT_CONN_DATA_CORRUPTION) ||
- FLD_ISSET(conn->debug_flags, WT_CONN_DEBUG_CORRUPTION_ABORT))
+ if (conn != NULL &&
+ (!F_ISSET(conn, WT_CONN_DATA_CORRUPTION) ||
+ FLD_ISSET(conn->debug_flags, WT_CONN_DEBUG_CORRUPTION_ABORT)))
__wt_abort(session);
#endif
- /*
- * !!!
- * This function MUST handle a NULL WT_SESSION_IMPL handle.
- *
- * Panic the connection;
- */
- if (session != NULL)
+
+ /* Panic the connection. */
+ if (conn != NULL)
F_SET(conn, WT_CONN_PANIC);
/*