diff options
author | Michael Lentine <mlentine@google.com> | 2015-02-19 01:21:04 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-02-19 01:21:04 +0000 |
commit | f6303459d1917cdbc956719b6e4a97ee2e4ba3f9 (patch) | |
tree | 7f71b8c4282fdcb4d41ffd28e9c5b7c88f4adb45 /libs | |
parent | cf359da98bdbfeaa256413009f9c6bf48e399831 (diff) | |
parent | a4201c10aeb977a6e4e8c1bcb9ceca5ab591d0ad (diff) | |
download | frameworks_native-f6303459d1917cdbc956719b6e4a97ee2e4ba3f9.zip frameworks_native-f6303459d1917cdbc956719b6e4a97ee2e4ba3f9.tar.gz frameworks_native-f6303459d1917cdbc956719b6e4a97ee2e4ba3f9.tar.bz2 |
am a4201c10: am 592cc33c: am e86f7e96: am 3c0272ba: am dc2d031a: am da9fd70d: am 2758eb2e: am fde92eb0: Update maxNumber to be smaller.
* commit 'a4201c10aeb977a6e4e8c1bcb9ceca5ab591d0ad':
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 425df38..638ac62 100644 --- a/libs/ui/GraphicBuffer.cpp +++ b/libs/ui/GraphicBuffer.cpp @@ -323,7 +323,11 @@ status_t GraphicBuffer::unflatten( const size_t numFds = static_cast<size_t>(buf[8]); const size_t numInts = static_cast<size_t>(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; |