diff options
| author | 2015-02-19 00:47:06 +0000 | |
|---|---|---|
| committer | 2015-02-19 00:47:06 +0000 | |
| commit | e86f7e96a75a7bf7bfa85d52cd9f2145fe25878c (patch) | |
| tree | d2ba1d9ab09e08552d7be483198d62019b9b0c8f /libs/ui/GraphicBuffer.cpp | |
| parent | 9b6be8e10b25f6f0bb949fec67b36fc773f5b591 (diff) | |
| parent | 3c0272ba8fbb98b5f1d45c52b1ae5292a8978e7d (diff) | |
am 3c0272ba: am dc2d031a: am da9fd70d: am 2758eb2e: am fde92eb0: Update maxNumber to be smaller.
* commit '3c0272ba8fbb98b5f1d45c52b1ae5292a8978e7d':
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 e768f13cf4..3ae88408d6 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; |