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

Commit 45476ab4 authored by Aayush Soni's avatar Aayush Soni
Browse files

C2SoftAmrWbEnc: Fix integer overflows leading to crash by changing data type

Bug: 218983266

Test: POC in bug descriptions
Test: atest VtsHalMediaC2V1_0TargetAudioEncTest
Test: atest CtsMediaTestCases:EncoderTest
Change-Id: I288e171aa9fc607f11a71abfbced9ab9d3d9f84f
parent 09b9e25e
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -307,7 +307,7 @@ void C2SoftAmrWbEnc::process(
        work->result = wView.error();
        return;
    }
    uint64_t outTimeStamp =
    int64_t outTimeStamp =
        mProcessedSamples * 1000000ll / mIntf->getSampleRate();
    size_t inPos = 0;
    size_t outPos = 0;
@@ -341,7 +341,7 @@ void C2SoftAmrWbEnc::process(
    ALOGV("causal sample size %d", mFilledLen);
    if (mIsFirst && outPos != 0) {
        mIsFirst = false;
        mAnchorTimeStamp = work->input.ordinal.timestamp.peekull();
        mAnchorTimeStamp = work->input.ordinal.timestamp.peekll();
    }
    fillEmptyWork(work);
    if (outPos != 0) {
+1 −1
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ private:
    bool mIsFirst;
    bool mSignalledError;
    bool mSignalledOutputEos;
    uint64_t mAnchorTimeStamp;
    int64_t mAnchorTimeStamp;
    uint64_t mProcessedSamples;
    int32_t mFilledLen;
    int16_t mInputFrame[kNumSamplesPerFrame];