Skip to content

[L0] Fix use after free with Module build strings #2474

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
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
6 changes: 2 additions & 4 deletions source/adapters/level_zero/program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,11 +452,9 @@ ur_result_t urProgramLinkExp(
// Build flags may be different for different devices, so handle them
// here. Clear values of the previous device first.
BuildFlagPtrs.clear();
std::vector<std::string> TemporaryOptionsStrings;
for (uint32_t I = 0; I < count; I++) {
TemporaryOptionsStrings.push_back(
phPrograms[I]->getBuildOptions(ZeDevice));
BuildFlagPtrs.push_back(TemporaryOptionsStrings.back().c_str());
BuildFlagPtrs.push_back(
phPrograms[I]->getBuildOptions(ZeDevice).c_str());
}
ZeExtModuleDesc.pBuildFlags = BuildFlagPtrs.data();
if (count == 1)
Expand Down
2 changes: 1 addition & 1 deletion source/adapters/level_zero/program.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ struct ur_program_handle_t_ : _ur_object {
DeviceDataMap[ZeDevice].BuildFlags += Options;
}

std::string getBuildOptions(ze_device_handle_t ZeDevice) {
std::string &getBuildOptions(ze_device_handle_t ZeDevice) {
return DeviceDataMap[ZeDevice].BuildFlags;
}

Expand Down
Loading