From: James Zern Date: Mon, 17 Sep 2018 19:32:58 +0000 (-0700) Subject: vpx_mem: allow VPX_MAX_ALLOCABLE_MEMORY to be overridden X-Git-Tag: v1.8.0~324 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=42e48983aa0e6f34c9643e24da7215fdbb692ef6;p=libvpx vpx_mem: allow VPX_MAX_ALLOCABLE_MEMORY to be overridden this allows the define to be set by the build environment Change-Id: Ib40111c5d9bae417b031b8b40a7bc135c6734044 --- diff --git a/vpx_mem/vpx_mem.c b/vpx_mem/vpx_mem.c index eeba34c37..18abf1158 100644 --- a/vpx_mem/vpx_mem.c +++ b/vpx_mem/vpx_mem.c @@ -16,12 +16,14 @@ #include "include/vpx_mem_intrnl.h" #include "vpx/vpx_integer.h" +#if !defined(VPX_MAX_ALLOCABLE_MEMORY) #if SIZE_MAX > (1ULL << 40) #define VPX_MAX_ALLOCABLE_MEMORY (1ULL << 40) #else // For 32-bit targets keep this below INT_MAX to avoid valgrind warnings. #define VPX_MAX_ALLOCABLE_MEMORY ((1ULL << 31) - (1 << 16)) #endif +#endif // Returns 0 in case of overflow of nmemb * size. static int check_size_argument_overflow(uint64_t nmemb, uint64_t size) {