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

Commit ebc26bd5 authored by Ray Essick's avatar Ray Essick Committed by android-build-merger
Browse files

Prevent OOB write in soft_avc encoder am: 463452a9 am: 97db64ba am:...

Prevent OOB write in soft_avc encoder am: 463452a9 am: 97db64ba am: b6bf4694 am: cd35c846 am: a43be7d4 am: 3c375611 am: 96b4e70f am: 9eb9b1b8
am: 91af834b

Change-Id: Icb076c1e7f90b7ece6cf7f36f9f2e5f3062121cf
parents 9ec59fc5 91af834b
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -613,6 +613,7 @@ OMX_ERRORTYPE SoftAVC::initEncoder() {
    IV_STATUS_T status;
    WORD32 level;
    uint32_t displaySizeY;

    CHECK(!mStarted);

    OMX_ERRORTYPE errType = OMX_ErrorNone;
@@ -916,6 +917,9 @@ OMX_ERRORTYPE SoftAVC::releaseEncoder() {
        }
    }

    // clear other pointers into the space being free()d
    mCodecCtx = NULL;

    mStarted = false;

    return OMX_ErrorNone;
@@ -1508,6 +1512,14 @@ void SoftAVC::onQueueFilled(OMX_U32 portIndex) {
    return;
}

void SoftAVC::onReset() {
    SoftVideoEncoderOMXComponent::onReset();

    if (releaseEncoder() != OMX_ErrorNone) {
        ALOGW("releaseEncoder failed");
    }
}

}  // namespace android

android::SoftOMXComponent *createSoftOMXComponent(
+2 −0
Original line number Diff line number Diff line
@@ -136,6 +136,8 @@ struct SoftAVC : public SoftVideoEncoderOMXComponent {
protected:
    virtual ~SoftAVC();

    virtual void onReset();

private:
    enum {
        kNumBuffers = 2,