mirror of
https://github.com/webmproject/libwebp.git
synced 2025-02-21 19:32:52 +01:00
utils: allow MALLOC_LIMIT to indicate a max
in addition to checking the environment for "MALLOC_LIMIT"; the environment will still take precedence. this is in preparation for adding extreme config value coverage to advanced_api_fuzzer Bug: chromium:1196850 Change-Id: Ibe22f5e39e030a422fd6e383269bde35252d3fae
This commit is contained in:
parent
a2fce86744
commit
109ff0f100
@ -101,6 +101,9 @@ static void Increment(int* const v) {
|
|||||||
#if defined(MALLOC_LIMIT)
|
#if defined(MALLOC_LIMIT)
|
||||||
{
|
{
|
||||||
const char* const malloc_limit_str = getenv("MALLOC_LIMIT");
|
const char* const malloc_limit_str = getenv("MALLOC_LIMIT");
|
||||||
|
#if MALLOC_LIMIT > 1
|
||||||
|
mem_limit = (size_t)MALLOC_LIMIT;
|
||||||
|
#endif
|
||||||
if (malloc_limit_str != NULL) {
|
if (malloc_limit_str != NULL) {
|
||||||
mem_limit = atoi(malloc_limit_str);
|
mem_limit = atoi(malloc_limit_str);
|
||||||
}
|
}
|
||||||
@ -175,7 +178,7 @@ static int CheckSizeArgumentsOverflow(uint64_t nmemb, size_t size) {
|
|||||||
return 0; // fake fail!
|
return 0; // fake fail!
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(MALLOC_LIMIT)
|
#if defined(PRINT_MEM_INFO) && defined(MALLOC_LIMIT)
|
||||||
if (mem_limit > 0) {
|
if (mem_limit > 0) {
|
||||||
const uint64_t new_total_mem = (uint64_t)total_mem + total_size;
|
const uint64_t new_total_mem = (uint64_t)total_mem + total_size;
|
||||||
if (new_total_mem != (size_t)new_total_mem ||
|
if (new_total_mem != (size_t)new_total_mem ||
|
||||||
|
Loading…
x
Reference in New Issue
Block a user