diff options
author | Michael Lentine <mlentine@google.com> | 2015-02-19 00:25:34 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-02-19 00:25:34 +0000 |
commit | dc2d031a7ee05725ad3d8cab4887d6c7a4063967 (patch) | |
tree | 66750510aaa95e4ab0b2c3b49b98ec836fb4e3ef /libs/ui | |
parent | d6308379d9ddf946f5ce60fa2d0b809fa1238a63 (diff) | |
parent | da9fd70de125b0e6df4fb6285f538be9133c7b22 (diff) | |
download | frameworks_native-dc2d031a7ee05725ad3d8cab4887d6c7a4063967.zip frameworks_native-dc2d031a7ee05725ad3d8cab4887d6c7a4063967.tar.gz frameworks_native-dc2d031a7ee05725ad3d8cab4887d6c7a4063967.tar.bz2 |
am da9fd70d: am 2758eb2e: am fde92eb0: Update maxNumber to be smaller.
* commit 'da9fd70de125b0e6df4fb6285f538be9133c7b22':
Update maxNumber to be smaller.
Diffstat (limited to 'libs/ui')
-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 a93b349..6c8272d 100644 --- a/libs/ui/GraphicBuffer.cpp +++ b/libs/ui/GraphicBuffer.cpp @@ -251,7 +251,11 @@ status_t GraphicBuffer::unflatten( const size_t numFds = buf[6]; const size_t numInts = buf[7]; - 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; |