diff options
| author | 2015-02-19 00:10:11 +0000 | |
|---|---|---|
| committer | 2015-02-19 00:10:11 +0000 | |
| commit | 2758eb2e67d935cf1f04e3d713438c6ac7fe8b89 (patch) | |
| tree | d9ea282e00d01b52bc126994b2b2b6453f17d054 /libs/ui/GraphicBuffer.cpp | |
| parent | 3d89edca65e07319c9ac3b9bb9889e80e8c40578 (diff) | |
| parent | fde92eb0ffcc37106d5fe85bf1f1ba30d8639d17 (diff) | |
am fde92eb0: Update maxNumber to be smaller.
* commit 'fde92eb0ffcc37106d5fe85bf1f1ba30d8639d17':
Update maxNumber to be smaller.
Diffstat (limited to 'libs/ui/GraphicBuffer.cpp')
| -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 4dff5f16e8..46a5a1d616 100644 --- a/libs/ui/GraphicBuffer.cpp +++ b/libs/ui/GraphicBuffer.cpp @@ -250,7 +250,11 @@ status_t GraphicBuffer::unflatten(void const* buffer, size_t size, 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; |