From 8cbabdbbe36d77379cbad3a5b96fe03b779ac9fb Mon Sep 17 00:00:00 2001 From: Alysa Liu Date: Mon, 26 May 2025 11:41:31 -0400 Subject: [PATCH] rocr: Unchecked return value as arg v1: Add value pointer validation before dereferencing in GetInfo method for MODULE_NAME case. Signed-off-by: Alysa Liu [ROCm/ROCR-Runtime commit: f1f34da4f6b5f8e0b0be320ef9c7c8208064fd7e] --- .../runtime/hsa-runtime/libamdhsacode/amd_hsa_code.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/rocr-runtime/runtime/hsa-runtime/libamdhsacode/amd_hsa_code.cpp b/projects/rocr-runtime/runtime/hsa-runtime/libamdhsacode/amd_hsa_code.cpp index 3862f8159a..9e49ba9d53 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/libamdhsacode/amd_hsa_code.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/libamdhsacode/amd_hsa_code.cpp @@ -145,6 +145,9 @@ namespace code { } case HSA_CODE_SYMBOL_INFO_MODULE_NAME: { std::string ModuleName = GetModuleName(); + if (!value) { + return HSA_STATUS_ERROR_INVALID_ARGUMENT; + } memset(value, 0x0, ModuleName.size()); memcpy(value, ModuleName.c_str(), ModuleName.size()); break;