From bd719ceb2085e3fef8cf5501fe16190b9e827e65 Mon Sep 17 00:00:00 2001 From: haoyuan2 Date: Fri, 15 Oct 2021 09:35:57 -0700 Subject: [PATCH] check if the input mode is valid, SWDEV-306130 Change-Id: I72fda84ca3159b00062d98d49be62cae48701a32 --- hipamd/src/hip_graph.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hipamd/src/hip_graph.cpp b/hipamd/src/hip_graph.cpp index 8244bdb018..2dc35b1e2f 100644 --- a/hipamd/src/hip_graph.cpp +++ b/hipamd/src/hip_graph.cpp @@ -700,7 +700,9 @@ hipError_t hipStreamBeginCapture(hipStream_t stream, hipStreamCaptureMode mode) hip::Stream* s = reinterpret_cast(stream); // capture cannot be initiated on legacy stream // It can be initiated if the stream is not already in capture mode - if (stream == nullptr || s->GetCaptureStatus() == hipStreamCaptureStatusActive) { + if (stream == nullptr || + (mode < hipStreamCaptureModeGlobal || mode > hipStreamCaptureModeRelaxed) || + s->GetCaptureStatus() == hipStreamCaptureStatusActive) { HIP_RETURN(hipErrorInvalidValue); } s->SetCaptureGraph(new ihipGraph());