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

Commit ee9ae7b8 authored by Baldev Sahu's avatar Baldev Sahu Committed by Steve Kondik
Browse files

libs/ui: Fix crash issue because of null pointer access

- handle NULL check is required while flatten GraphicsBuffer

CRs-fixed: 579102

Change-Id: I292b4b25dc1f5320378cc9e4affbad326e1fdaed
parent 9241b7c6
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -260,12 +260,12 @@ status_t GraphicBuffer::flatten(void*& buffer, size_t& size, int*& fds, size_t&
        native_handle_t const* const h = handle;
        memcpy(fds,     h->data,             h->numFds*sizeof(int));
        memcpy(&buf[8], h->data + h->numFds, h->numInts*sizeof(int));
        fds += handle->numFds;
        count -= handle->numFds;
    }

    buffer = reinterpret_cast<void*>(static_cast<int*>(buffer) + sizeNeeded);
    size -= sizeNeeded;
    fds += handle->numFds;
    count -= handle->numFds;

    return NO_ERROR;
}