From becdcec147adf140077699f23f673c0fe32f9477 Mon Sep 17 00:00:00 2001 From: Francisco Casas Date: Thu, 6 Jun 2024 12:57:38 -0400 Subject: [PATCH] vkd3d-shader: Avoid div by zero on assert in vkd3d_calloc() (ubsan). --- include/private/vkd3d_memory.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/private/vkd3d_memory.h b/include/private/vkd3d_memory.h index e191dc11..b157fc07 100644 --- a/include/private/vkd3d_memory.h +++ b/include/private/vkd3d_memory.h @@ -43,7 +43,7 @@ static inline void *vkd3d_realloc(void *ptr, size_t size) static inline void *vkd3d_calloc(size_t count, size_t size) { void *ptr; - VKD3D_ASSERT(count <= ~(size_t)0 / size); + VKD3D_ASSERT(!size || count <= ~(size_t)0 / size); if (!(ptr = calloc(count, size))) ERR("Out of memory.\n"); return ptr;