Skip to content

Commit 3b81059

Browse files
committed
[L0] Fix use after free with Module build strings
- Address Sanitizer HASAN fails with temporary strings even after last use after free patch. This change resolves all use after free of these strings satifsying the address sanitzer checks with HASAN. Signed-off-by: Neil R. Spruit <[email protected]>
1 parent 0b04127 commit 3b81059

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

source/adapters/level_zero/program.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -452,11 +452,9 @@ ur_result_t urProgramLinkExp(
452452
// Build flags may be different for different devices, so handle them
453453
// here. Clear values of the previous device first.
454454
BuildFlagPtrs.clear();
455-
std::vector<std::string> TemporaryOptionsStrings;
456455
for (uint32_t I = 0; I < count; I++) {
457-
TemporaryOptionsStrings.push_back(
458-
phPrograms[I]->getBuildOptions(ZeDevice));
459-
BuildFlagPtrs.push_back(TemporaryOptionsStrings.back().c_str());
456+
BuildFlagPtrs.push_back(
457+
phPrograms[I]->getBuildOptions(ZeDevice).c_str());
460458
}
461459
ZeExtModuleDesc.pBuildFlags = BuildFlagPtrs.data();
462460
if (count == 1)

source/adapters/level_zero/program.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ struct ur_program_handle_t_ : _ur_object {
169169
DeviceDataMap[ZeDevice].BuildFlags += Options;
170170
}
171171

172-
std::string getBuildOptions(ze_device_handle_t ZeDevice) {
172+
std::string &getBuildOptions(ze_device_handle_t ZeDevice) {
173173
return DeviceDataMap[ZeDevice].BuildFlags;
174174
}
175175

0 commit comments

Comments
 (0)