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

Commit 5ced6f83 authored by Nick Kralevich's avatar Nick Kralevich Committed by Android (Google) Code Review
Browse files

Merge changes I89e3a827,I0ab786ca

* changes:
  Fix harmless unsigned overflow in recoverPTS
  Fix benign unsigned integer overflows in loop conditions
parents 0f993621 3728ba36
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -1321,7 +1321,8 @@ ACodec::BufferInfo *ACodec::dequeueBufferFromNativeWindow() {
        }

        bool stale = false;
        for (size_t i = mBuffers[kPortIndexOutput].size(); i-- > 0;) {
        for (size_t i = mBuffers[kPortIndexOutput].size(); i > 0;) {
            i--;
            BufferInfo *info = &mBuffers[kPortIndexOutput].editItemAt(i);

            if (info->mGraphicBuffer != NULL &&
@@ -1364,7 +1365,8 @@ ACodec::BufferInfo *ACodec::dequeueBufferFromNativeWindow() {

    // get oldest undequeued buffer
    BufferInfo *oldest = NULL;
    for (size_t i = mBuffers[kPortIndexOutput].size(); i-- > 0;) {
    for (size_t i = mBuffers[kPortIndexOutput].size(); i > 0;) {
        i--;
        BufferInfo *info =
            &mBuffers[kPortIndexOutput].editItemAt(i);
        if (info->mStatus == BufferInfo::OWNED_BY_NATIVE_WINDOW &&
+1 −1
Original line number Diff line number Diff line
@@ -509,7 +509,7 @@ int64_t ATSParser::Program::recoverPTS(uint64_t PTS_33bit) {
        mLastRecoveredPTS = static_cast<int64_t>(PTS_33bit);
    } else {
        mLastRecoveredPTS = static_cast<int64_t>(
                ((mLastRecoveredPTS - PTS_33bit + 0x100000000ll)
                ((mLastRecoveredPTS - static_cast<int64_t>(PTS_33bit) + 0x100000000ll)
                & 0xfffffffe00000000ull) | PTS_33bit);
        // We start from 0, but recovered PTS could be slightly below 0.
        // Clamp it to 0 as rest of the pipeline doesn't take negative pts.
+2 −1
Original line number Diff line number Diff line
@@ -1589,7 +1589,8 @@ void OMXNodeInstance::removeActiveBuffer(
void OMXNodeInstance::freeActiveBuffers() {
    // Make sure to count down here, as freeBuffer will in turn remove
    // the active buffer from the vector...
    for (size_t i = mActiveBuffers.size(); i--;) {
    for (size_t i = mActiveBuffers.size(); i > 0;) {
        i--;
        freeBuffer(mActiveBuffers[i].mPortIndex, mActiveBuffers[i].mID);
    }
}