From 880f1f004900822e8fb5a8349515c1cf15d24359 Mon Sep 17 00:00:00 2001 From: Rakesh Roy Date: Mon, 1 Apr 2024 12:50:48 +0530 Subject: [PATCH] SWDEV-450361 - Add nullptr validation for waitStream - Application is passing null for parameter stream in API hipStreamWaitEvent - When event stream isn't capturing and event is not recorded, causes segfault because we are accessing deviceId() from waitStream Change-Id: I8b87ffd6f234677f68b66dcb7ef44b2ff04a7c91 --- hipamd/src/hip_stream.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hipamd/src/hip_stream.cpp b/hipamd/src/hip_stream.cpp index c8a35a53ab..2e80e8e906 100644 --- a/hipamd/src/hip_stream.cpp +++ b/hipamd/src/hip_stream.cpp @@ -463,7 +463,7 @@ hipError_t hipStreamWaitEvent_common(hipStream_t stream, hipEvent_t event, unsig // If stream is capturing but event is not recorded on event's stream. return hipErrorStreamCaptureIsolation; } - if (eventStream->DeviceId() == waitStream->DeviceId()) { + if ((waitStream != nullptr) && (eventStream->DeviceId() == waitStream->DeviceId())) { eventStream->GetDevice()->AddSafeStream(eventStream, waitStream); } }