Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions projects/miopen/src/hipoc/hipoc_program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,22 +175,22 @@ HIPOCProgramImpl::HIPOCProgramImpl(const fs::path& program_name, const fs::path&
}

HIPOCProgramImpl::HIPOCProgramImpl(const fs::path& program_name, const std::vector<char>& blob)
: program(program_name) ///, module(CreateModuleInMem(blob))
: program(program_name), binary(blob) // Store the binary data to prevent use-after-free
{
const auto& arch = env::value(MIOPEN_DEVICE_ARCH);
if(!arch.empty())
return;
module = CreateModuleInMem(blob);
module = CreateModuleInMem(binary); // Use stored binary instead of parameter
}

HIPOCProgramImpl::HIPOCProgramImpl(const fs::path& program_name,
const std::vector<uint8_t>& blob)
: program(program_name) ///, module(CreateModuleInMem(blob))
HIPOCProgramImpl::HIPOCProgramImpl(const fs::path& program_name, const std::vector<uint8_t>& blob)
: program(program_name),
binary(blob.begin(), blob.end()) // Store the binary data to prevent use-after-free
{
const auto& arch = env::value(MIOPEN_DEVICE_ARCH);
if(!arch.empty())
return;
module = CreateModuleInMem(blob);
module = CreateModuleInMem(binary); // Use stored binary instead of parameter
}

HIPOCProgramImpl::HIPOCProgramImpl(const fs::path& program_name,
Expand Down
Loading