Compare commits

..

2 Commits

Author SHA1 Message Date
CiroZDP
54e20d509d
Merge 0c70f22410 into dbadda2683 2025-12-29 21:32:28 +00:00
CiroZDP
0c70f22410
Fix allocation size overflow check 2025-12-29 22:32:24 +01:00

View File

@ -251,13 +251,13 @@ void* _glfw_calloc(size_t count, size_t size)
if (!count || !size)
return NULL;
const size_t total_size = count * size;
if (total_size > SIZE_MAX)
if (count > SIZE_MAX / size)
{
_glfwInputError(GLFW_INVALID_VALUE, "Allocation size overflow");
return NULL;
}
const size_t total_size = count * size;
void* block = _glfw.allocator.allocate(total_size, _glfw.allocator.user);
if (!block)
{