mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader: Avoid div by zero on assert in vkd3d_calloc() (ubsan).
This commit is contained in:
parent
94c74d2c00
commit
becdcec147
Notes:
Henri Verbeet
2024-08-20 21:34:57 +02:00
Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1006
@ -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)
|
static inline void *vkd3d_calloc(size_t count, size_t size)
|
||||||
{
|
{
|
||||||
void *ptr;
|
void *ptr;
|
||||||
VKD3D_ASSERT(count <= ~(size_t)0 / size);
|
VKD3D_ASSERT(!size || count <= ~(size_t)0 / size);
|
||||||
if (!(ptr = calloc(count, size)))
|
if (!(ptr = calloc(count, size)))
|
||||||
ERR("Out of memory.\n");
|
ERR("Out of memory.\n");
|
||||||
return ptr;
|
return ptr;
|
||||||
|
Loading…
Reference in New Issue
Block a user