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

Commit 3c375611 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: b6bf4694 am: cd35c846

am: a43be7d4

Change-Id: I9cf2d9117293f14f14fc240c674f02594f8944bd
parents 2046d331 a43be7d4
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -614,6 +614,7 @@ OMX_ERRORTYPE SoftAVC::initEncoder() {
    IV_STATUS_T status;
    WORD32 level;
    uint32_t displaySizeY;

    CHECK(!mStarted);

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

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

    mStarted = false;

    return OMX_ErrorNone;
@@ -1509,6 +1513,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,