Skip to content
Draft
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: 5 additions & 1 deletion unified-runtime/source/adapters/cuda/kernel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,13 @@ struct ur_kernel_handle_t_ : ur::cuda::handle_base {
}
// Otherwise, update the existing argument.
else {
// Validate that the update size matches the original size to prevent
// heap buffer overflow
if (Size != ParamSizes[Index]) {
throw UR_RESULT_ERROR_INVALID_ARGUMENT;
}
std::memcpy(ArgPointers[Index], Arg, Size);
AlignedLocalMemSize[Index] = LocalSize;
assert(Size == ParamSizes[Index]);
}
}

Expand Down
6 changes: 5 additions & 1 deletion unified-runtime/source/adapters/hip/kernel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,13 @@ struct ur_kernel_handle_t_ : ur::hip::handle_base {
}
// Otherwise, update the existing argument.
else {
// Validate that the update size matches the original size to prevent
// heap buffer overflow
if (Size != ParamSizes[Index]) {
throw UR_RESULT_ERROR_INVALID_ARGUMENT;
}
std::memcpy(ArgPointers[Index], Arg, Size);
AlignedLocalMemSize[Index] = LocalSize;
assert(Size == ParamSizes[Index]);
}
}

Expand Down
Loading