rusticl/program: check if provided binary pointers are null

Cc: mesa-stable
Reviewed-by: @LingMan
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32268>
This commit is contained in:
Karol Herbst
2024-11-20 12:56:01 +01:00
committed by Marge Bot
parent ff76d27554
commit 6fd6de46dc

View File

@@ -493,7 +493,11 @@ impl Program {
};
let lock = self.build_info();
for (i, d) in self.devs.iter().enumerate() {
for (d, ptr) in self.devs.iter().zip(ptrs) {
if ptr.is_null() {
return Err(CL_INVALID_VALUE);
}
let info = lock.dev_build(d);
// no spirv means nothing to write
@@ -506,7 +510,7 @@ impl Program {
let mut blob = blob::default();
// sadly we have to trust the buffer to be correctly sized...
blob_init_fixed(&mut blob, ptrs[i].cast(), usize::MAX);
blob_init_fixed(&mut blob, ptr.cast(), usize::MAX);
blob_write_bytes(
&mut blob,