mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-20 12:28:26 +01:00
lower WEBP_MAX_ALLOCABLE_MEMORY default
restrict to 2^34 for 64-bit targets, < 2^32 for 32-bit Change-Id: Iff4ce40ae2c3c7fc119f018c2128dbe8f744341f
This commit is contained in:
parent
eee0cce158
commit
b8384b53d6
@ -20,6 +20,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
#include "../dsp/dsp.h"
|
#include "../dsp/dsp.h"
|
||||||
#include "../webp/types.h"
|
#include "../webp/types.h"
|
||||||
@ -32,7 +33,14 @@ extern "C" {
|
|||||||
// Memory allocation
|
// Memory allocation
|
||||||
|
|
||||||
// This is the maximum memory amount that libwebp will ever try to allocate.
|
// This is the maximum memory amount that libwebp will ever try to allocate.
|
||||||
#define WEBP_MAX_ALLOCABLE_MEMORY (1ULL << 40)
|
#ifndef WEBP_MAX_ALLOCABLE_MEMORY
|
||||||
|
#if SIZE_MAX > (1ULL << 34)
|
||||||
|
#define WEBP_MAX_ALLOCABLE_MEMORY (1ULL << 34)
|
||||||
|
#else
|
||||||
|
// For 32-bit targets keep this below INT_MAX to avoid valgrind warnings.
|
||||||
|
#define WEBP_MAX_ALLOCABLE_MEMORY ((1ULL << 31) - (1 << 16))
|
||||||
|
#endif
|
||||||
|
#endif // WEBP_MAX_ALLOCABLE_MEMORY
|
||||||
|
|
||||||
// size-checking safe malloc/calloc: verify that the requested size is not too
|
// size-checking safe malloc/calloc: verify that the requested size is not too
|
||||||
// large, or return NULL. You don't need to call these for constructs like
|
// large, or return NULL. You don't need to call these for constructs like
|
||||||
|
Loading…
Reference in New Issue
Block a user