From 303a4572acbc29dec756aaa5709354535cda27b9 Mon Sep 17 00:00:00 2001 From: Mahin Pandya Date: Tue, 24 Sep 2024 05:27:39 -0500 Subject: [PATCH] Issue #35989 Potential Crash in GRPC code --- src/core/lib/promise/activity.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/core/lib/promise/activity.h b/src/core/lib/promise/activity.h index b84fc473b6249..645ddf9ef8516 100644 --- a/src/core/lib/promise/activity.h +++ b/src/core/lib/promise/activity.h @@ -668,11 +668,13 @@ ActivityPtr MakeActivity(Factory promise_factory, } inline Pending IntraActivityWaiter::pending() { - const auto new_wakeups = GetContext()->CurrentParticipant(); - GRPC_TRACE_LOG(promise_primitives, INFO) - << "IntraActivityWaiter::pending: " - << GRPC_DUMP_ARGS(this, new_wakeups, wakeups_); - wakeups_ |= new_wakeups; + if (Activity::current()) { + const auto new_wakeups = GetContext()->CurrentParticipant(); + GRPC_TRACE_LOG(promise_primitives, INFO) + << "IntraActivityWaiter::pending: " + << GRPC_DUMP_ARGS(this, new_wakeups, wakeups_); + wakeups_ |= new_wakeups; + } return Pending(); }