diff options
author | Michael Lentine <mlentine@google.com> | 2015-02-19 00:15:40 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-02-19 00:15:40 +0000 |
commit | da9fd70de125b0e6df4fb6285f538be9133c7b22 (patch) | |
tree | 3c5617e4d60cf634cf241bb306a55e2eea49ac75 /libs | |
parent | 76ebd319d96494049a2a598f4449c0ec417220f6 (diff) | |
parent | 2758eb2e67d935cf1f04e3d713438c6ac7fe8b89 (diff) | |
download | frameworks_native-da9fd70de125b0e6df4fb6285f538be9133c7b22.tar.gz frameworks_native-da9fd70de125b0e6df4fb6285f538be9133c7b22.tar.bz2 frameworks_native-da9fd70de125b0e6df4fb6285f538be9133c7b22.zip |
am 2758eb2e: am fde92eb0: Update maxNumber to be smaller.
* commit '2758eb2e67d935cf1f04e3d713438c6ac7fe8b89':
Update maxNumber to be smaller.
Diffstat (limited to 'libs')
-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 dde724dd6..8c325fd3f 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; |