am da9fd70d: am 2758eb2e: am fde92eb0: Update maxNumber to be smaller.

* commit 'da9fd70de125b0e6df4fb6285f538be9133c7b22':
  Update maxNumber to be smaller.
This commit is contained in:
Michael Lentine 2015-02-19 00:25:34 +00:00 committed by Android Git Automerger
commit dc2d031a7e
1 changed files with 5 additions and 1 deletions

View File

@ -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;