From d1be63c355b2cd95c4634706f11fa0da2475c39b Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Mon, 21 Jul 2025 15:03:01 -0400 Subject: [PATCH] spirv: Assert that vtn_pointer_to_deref() doesn't return NULL There are a few things that could cause us to return NULL here and we should just fail to parse the SPIR-V if that ever happens instead of crashing when someone tries to access it. Reviewed-by: Caio Oliveira Part-of: --- src/compiler/spirv/vtn_variables.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c index 7891e6c1c20..def039bc341 100644 --- a/src/compiler/spirv/vtn_variables.c +++ b/src/compiler/spirv/vtn_variables.c @@ -524,6 +524,8 @@ vtn_pointer_to_deref(struct vtn_builder *b, struct vtn_pointer *ptr) ptr = vtn_pointer_dereference(b, ptr, &chain); } + vtn_assert(ptr->deref != NULL); + return ptr->deref; }