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

Commit e36e1034 authored by Haynes Mathew George's avatar Haynes Mathew George Committed by Wei Jia
Browse files

libstagefright: Add NULL check during memcpy for MediaCodecSource



Add null check for the source buffer prior to memcpy.
Test: compiles
Change-Id: I5971e0c01fd4821078780c9623154e396f679357
CRs-Fixed: 1096369

authored-by: default avatarGarmond <Leung&lt;garmondl@codeaurora.org>
(cherry picked from commit 85bb3ddece3140a59e1ecb25187e0d69fe85f002)
parent 2b934d36
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -689,7 +689,9 @@ status_t MediaCodecSource::feedEncoderInputBuffers() {

            sp<MediaCodecBuffer> inbuf;
            status_t err = mEncoder->getInputBuffer(bufferIndex, &inbuf);
            if (err != OK || inbuf == NULL) {

            if (err != OK || inbuf == NULL || inbuf->data() == NULL
                    || mbuf->data() == NULL || mbuf->size() == 0) {
                mbuf->release();
                signalEOS();
                break;
@@ -851,7 +853,8 @@ void MediaCodecSource::onMessageReceived(const sp<AMessage> &msg) {

            sp<MediaCodecBuffer> outbuf;
            status_t err = mEncoder->getOutputBuffer(index, &outbuf);
            if (err != OK || outbuf == NULL) {
            if (err != OK || outbuf == NULL || outbuf->data() == NULL
                || outbuf->size() == 0) {
                signalEOS();
                break;
            }