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

Commit 2dc73406 authored by Wonsik Kim's avatar Wonsik Kim
Browse files

C2SoftAvcEnc: don't crash at unexpected input

Report failure instead of crash at input buffer size different than
what's configured.

Bug: 74073134
Test: adb shell setprop debug.stagefright.ccodec yes
Test: adb shell setprop debug.stagefright.omx_default_rank 1000
Test: adb shell killall mediaserver
Test: atest android.media.cts.MediaCodecTest
Change-Id: Id6c5eef205ae56f7b120cf5030630c7eabd8bc30
(cherry picked from commit fab635c8)
parent 6fd4657e
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -909,6 +909,9 @@ c2_status_t C2SoftAvcEnc::setEncodeArgs(
    }

    ALOGV("width = %d, height = %d", input->width(), input->height());
    if (mWidth != input->width() || mHeight != input->height()) {
        return C2_BAD_VALUE;
    }
    const C2PlanarLayout &layout = input->layout();
    uint8_t *yPlane = const_cast<uint8_t *>(input->data()[C2PlanarLayout::PLANE_Y]);
    uint8_t *uPlane = const_cast<uint8_t *>(input->data()[C2PlanarLayout::PLANE_U]);