diff options
author | Michael Lentine <mlentine@google.com> | 2015-02-18 10:14:18 -0800 |
---|---|---|
committer | The Android Automerger <android-build@google.com> | 2015-02-18 20:57:20 -0800 |
commit | 796aaf7fb160fea12bddc8406d7f006ce811eb43 (patch) | |
tree | d2ba1d9ab09e08552d7be483198d62019b9b0c8f | |
parent | 52704dd3afe59d038a101b0a1747f66cc5b70496 (diff) | |
download | frameworks_native-android-cts-5.1_r1.zip frameworks_native-android-cts-5.1_r1.tar.gz frameworks_native-android-cts-5.1_r1.tar.bz2 |
Update maxNumber to be smaller.android-cts-5.1_r2android-cts-5.1_r1android-5.1.1_r9android-5.1.1_r6android-5.1.1_r4android-5.1.1_r3android-5.1.1_r2android-5.1.1_r10android-5.1.1_r1android-5.1.0_r5android-5.1.0_r4android-5.1.0_r3android-5.1.0_r1
There shouldn't be more than 4096 fds (probably signficantly smaller) and
there shouldn't be more than 4096 ints.
Bug: 18076253
Change-Id: I3a3e50ee3078a4710e9737114e65afc923ed0573
-rw-r--r-- | libs/ui/GraphicBuffer.cpp | 6 |
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; |