Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a4201c10 authored by Michael Lentine's avatar Michael Lentine Committed by Android Git Automerger
Browse files

am 592cc33c: am e86f7e96: am 3c0272ba: am dc2d031a: am da9fd70d: am 2758eb2e:...

am 592cc33c: am e86f7e96: am 3c0272ba: am dc2d031a: am da9fd70d: am 2758eb2e: am fde92eb0: Update maxNumber to be smaller.

* commit '592cc33c':
  Update maxNumber to be smaller.
parents bf4fed77 592cc33c
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -323,7 +323,11 @@ status_t GraphicBuffer::unflatten(
    const size_t numFds  = static_cast<size_t>(buf[8]);
    const size_t numFds  = static_cast<size_t>(buf[8]);
    const size_t numInts = static_cast<size_t>(buf[9]);
    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)) {
    if (numFds >= maxNumber || numInts >= (maxNumber - 10)) {
        width = height = stride = format = usage = 0;
        width = height = stride = format = usage = 0;
        handle = NULL;
        handle = NULL;