From a7793501811399af3d971e0ab5ae4e775a6914f7 Mon Sep 17 00:00:00 2001 From: Jatin Chaudhary Date: Wed, 16 Sep 2020 08:27:55 -0400 Subject: [PATCH] Adding checks for return type compatibility with CUDA Change-Id: I09b6bd9a7299f0a97ac9011ea0903a1f81e28251 --- rocclr/hip_fatbin.cpp | 3 +++ rocclr/hip_platform.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/rocclr/hip_fatbin.cpp b/rocclr/hip_fatbin.cpp index b8e7c85bda..8072c18b36 100755 --- a/rocclr/hip_fatbin.cpp +++ b/rocclr/hip_fatbin.cpp @@ -64,6 +64,9 @@ hipError_t FatBinaryInfo::ExtractFatBinary(const std::vector& devi if (!amd::Os::GetFileHandle(fname_.c_str(), &fdesc_, &fsize_)) { return hipErrorFileNotFound; } + if (fsize_ == 0) { + return hipErrorInvalidKernelFile; + } // Extract the code object from file hip_error = CodeObject::ExtractCodeObjectFromFile(fdesc_, fsize_, diff --git a/rocclr/hip_platform.cpp b/rocclr/hip_platform.cpp index cc206e6cb7..03bebeb7fb 100755 --- a/rocclr/hip_platform.cpp +++ b/rocclr/hip_platform.cpp @@ -773,6 +773,9 @@ hipError_t PlatformState::getDynFunc(hipFunction_t* hfunc, hipModule_t hmod, DevLogPrintfError("Cannot find the module: 0x%x", hmod); return hipErrorNotFound; } + if (0 == strlen(func_name)) { + return hipErrorNotFound; + } return it->second->getDynFunc(hfunc, func_name); }