summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Lentine <mlentine@google.com>2015-02-19 00:32:42 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-02-19 00:32:42 +0000
commit3c0272ba8fbb98b5f1d45c52b1ae5292a8978e7d (patch)
treefd6352fdada1bf15f133a817adad346bf6db7332
parent784fd39a19f659e3b464bd9a78361c0adc1cdcab (diff)
parentdc2d031a7ee05725ad3d8cab4887d6c7a4063967 (diff)
downloadframeworks_native-3c0272ba8fbb98b5f1d45c52b1ae5292a8978e7d.zip
frameworks_native-3c0272ba8fbb98b5f1d45c52b1ae5292a8978e7d.tar.gz
frameworks_native-3c0272ba8fbb98b5f1d45c52b1ae5292a8978e7d.tar.bz2
am dc2d031a: am da9fd70d: am 2758eb2e: am fde92eb0: Update maxNumber to be smaller.
* commit 'dc2d031a7ee05725ad3d8cab4887d6c7a4063967': Update maxNumber to be smaller.
-rw-r--r--libs/ui/GraphicBuffer.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/libs/ui/GraphicBuffer.cpp b/libs/ui/GraphicBuffer.cpp
index e768f13..3ae8840 100644
--- a/libs/ui/GraphicBuffer.cpp
+++ b/libs/ui/GraphicBuffer.cpp
@@ -310,7 +310,11 @@ status_t GraphicBuffer::unflatten(
const size_t numFds = buf[8];
const size_t numInts = buf[9];
- const size_t maxNumber = UINT_MAX / sizeof(int);
+ // Limit the maxNumber to be relatively small. The number of fds or ints
+ // should not come close to this number, and the number itself was simply
+ // chosen to be high enough to not cause issues and low enough to prevent
+ // overflow problems.
+ const size_t maxNumber = 4096;
if (numFds >= maxNumber || numInts >= (maxNumber - 10)) {
width = height = stride = format = usage = 0;
handle = NULL;