mirror of
				https://github.com/webmproject/libwebp.git
				synced 2025-10-30 01:53:34 +01:00 
			
		
		
		
	Merge "fix a potential overflow with MALLOC_LIMIT"
This commit is contained in:
		| @@ -175,9 +175,13 @@ static int CheckSizeArgumentsOverflow(uint64_t nmemb, size_t size) { | ||||
|   } | ||||
| #endif | ||||
| #if defined(MALLOC_LIMIT) | ||||
|   if (mem_limit > 0 && total_mem + total_size >= mem_limit) { | ||||
|   if (mem_limit > 0) { | ||||
|     const uint64_t new_total_mem = (uint64_t)total_mem + total_size; | ||||
|     if (new_total_mem != (size_t)new_total_mem || | ||||
|         new_total_mem > mem_limit) { | ||||
|       return 0;   // fake fail! | ||||
|     } | ||||
|   } | ||||
| #endif | ||||
|  | ||||
|   return 1; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user