mirror of
https://github.com/glfw/glfw.git
synced 2026-01-11 08:43:25 +00:00
Compare commits
1 Commits
54e20d509d
...
5cbeb84c5d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5cbeb84c5d |
@ -251,13 +251,13 @@ void* _glfw_calloc(size_t count, size_t size)
|
|||||||
if (!count || !size)
|
if (!count || !size)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (count > SIZE_MAX / size)
|
const size_t total_size = count * size;
|
||||||
|
if (total_size > SIZE_MAX)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_VALUE, "Allocation size overflow");
|
_glfwInputError(GLFW_INVALID_VALUE, "Allocation size overflow");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const size_t total_size = count * size;
|
|
||||||
void* block = _glfw.allocator.allocate(total_size, _glfw.allocator.user);
|
void* block = _glfw.allocator.allocate(total_size, _glfw.allocator.user);
|
||||||
if (!block)
|
if (!block)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user