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

Commit 5915ce01 authored by Chad Brubaker's avatar Chad Brubaker
Browse files

Fix benign unsigned integer overflows in loop conditions

This is causing an abort when running with unsigned integer overflow
detection, change the code to no longer do i-- when i = 0.

Change-Id: I0ab786cabb3a3d37fa24a3b8da0c35dd475ca273
(cerry picked from commit b92add32)
parent 4e854bf5
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -949,7 +949,8 @@ ACodec::BufferInfo *ACodec::dequeueBufferFromNativeWindow() {
    }

    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);

+2 −1
Original line number Diff line number Diff line
@@ -1350,7 +1350,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);
    }
}