Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Unified Diff: third_party/libwebp/utils/utils.h

Issue 2584033003: libwebp-0.5.2-rc2 (Closed)
Patch Set: layout tests Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/libwebp/utils/utils.h
diff --git a/third_party/libwebp/utils/utils.h b/third_party/libwebp/utils/utils.h
index e0a81126df8e703b10cf529b2a89c610573c0b93..3a5d4e6a7885283295e05325d841a176f825f643 100644
--- a/third_party/libwebp/utils/utils.h
+++ b/third_party/libwebp/utils/utils.h
@@ -20,6 +20,7 @@
#endif
#include <assert.h>
+#include <limits.h>
#include "../dsp/dsp.h"
#include "../webp/types.h"
@@ -32,7 +33,14 @@ extern "C" {
// Memory allocation
// 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
// large, or return NULL. You don't need to call these for constructs like

Powered by Google App Engine
This is Rietveld 408576698