diff --git a/projects/clr/rocclr/runtime/device/gpu/gpuprintf.cpp b/projects/clr/rocclr/runtime/device/gpu/gpuprintf.cpp index 58120a4002..3ae7b7c479 100644 --- a/projects/clr/rocclr/runtime/device/gpu/gpuprintf.cpp +++ b/projects/clr/rocclr/runtime/device/gpu/gpuprintf.cpp @@ -608,7 +608,10 @@ bool PrintfDbgHSA::output(VirtualGPU& gpu, bool printfEnabled, // parse the debug buffer while (sbt < copySize) { - assert(((*dbgBufferPtr) < printfInfo.size()) && "Cound't find the reported PrintfID!"); + if (*dbgBufferPtr >= printfInfo.size()) { + LogError("Couldn't find the reported PrintfID!"); + return false; + } const PrintfInfo& info = printfInfo[(*dbgBufferPtr)]; sb += sizeof(uint32_t); for (ita = info.arguments_.begin(); ita != info.arguments_.end(); ++ita) { diff --git a/projects/clr/rocclr/runtime/device/pal/palprintf.cpp b/projects/clr/rocclr/runtime/device/pal/palprintf.cpp index b8933e769f..8f027ae847 100644 --- a/projects/clr/rocclr/runtime/device/pal/palprintf.cpp +++ b/projects/clr/rocclr/runtime/device/pal/palprintf.cpp @@ -604,7 +604,10 @@ bool PrintfDbgHSA::output(VirtualGPU& gpu, bool printfEnabled, // parse the debug buffer while (sbt < copySize) { - assert(((*dbgBufferPtr) < printfInfo.size()) && "Cound't find the reported PrintfID!"); + if (*dbgBufferPtr >= printfInfo.size()) { + LogError("Couldn't find the reported PrintfID!"); + return false; + } const PrintfInfo& info = printfInfo[(*dbgBufferPtr)]; sb += sizeof(uint32_t); for (ita = info.arguments_.begin(); ita != info.arguments_.end(); ++ita) { diff --git a/projects/clr/rocclr/runtime/device/rocm/rocprintf.cpp b/projects/clr/rocclr/runtime/device/rocm/rocprintf.cpp index fcf7dfb2e8..82a86d8059 100644 --- a/projects/clr/rocclr/runtime/device/rocm/rocprintf.cpp +++ b/projects/clr/rocclr/runtime/device/rocm/rocprintf.cpp @@ -421,7 +421,10 @@ bool PrintfDbg::output(VirtualGPU& gpu, bool printfEnabled, // parse the debug buffer while (sbt < offsetSize) { - assert(((*dbgBufferPtr) < printfInfo.size()) && "Cound't find the reported PrintfID!"); + if (*dbgBufferPtr >= printfInfo.size()) { + LogError("Couldn't find the reported PrintfID!"); + return false; + } const PrintfInfo& info = printfInfo[(*dbgBufferPtr)]; sb += sizeof(uint32_t); for (ita = info.arguments_.begin(); ita != info.arguments_.end(); ++ita) {