summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Lentine <mlentine@google.com>2015-02-19 02:14:00 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-02-19 02:14:00 +0000
commitbd6f5b27386b666f66ebb209e9235db9bb7f7db5 (patch)
treed2ba1d9ab09e08552d7be483198d62019b9b0c8f
parentbe6ad4c236e33b8298db478673f6f514c9c3eadb (diff)
parente86f7e96a75a7bf7bfa85d52cd9f2145fe25878c (diff)
downloadframeworks_native-bd6f5b27386b666f66ebb209e9235db9bb7f7db5.zip
frameworks_native-bd6f5b27386b666f66ebb209e9235db9bb7f7db5.tar.gz
frameworks_native-bd6f5b27386b666f66ebb209e9235db9bb7f7db5.tar.bz2
am e86f7e96: am 3c0272ba: am dc2d031a: am da9fd70d: am 2758eb2e: am fde92eb0: Update maxNumber to be smaller.android-5.1.1_r5android-5.1.1_r12
* commit 'e86f7e96a75a7bf7bfa85d52cd9f2145fe25878c': 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;