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

Commit c454fe0c authored by Jon Larimer's avatar Jon Larimer Committed by Android Git Automerger
Browse files

am f5397f6b: Merge "Fix several ineffective integer overflow checks"

* commit 'f5397f6b':
  Fix several ineffective integer overflow checks
parents 572d88c7 f5397f6b
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -335,7 +335,7 @@ status_t SampleTable::setTimeToSampleParams(
    }

    mTimeToSampleCount = U32_AT(&header[4]);
    uint64_t allocSize = mTimeToSampleCount * 2 * sizeof(uint32_t);
    uint64_t allocSize = mTimeToSampleCount * 2 * (uint64_t)sizeof(uint32_t);
    if (allocSize > SIZE_MAX) {
        return ERROR_OUT_OF_RANGE;
    }
@@ -383,7 +383,7 @@ status_t SampleTable::setCompositionTimeToSampleParams(
    }

    mNumCompositionTimeDeltaEntries = numEntries;
    uint64_t allocSize = numEntries * 2 * sizeof(uint32_t);
    uint64_t allocSize = numEntries * 2 * (uint64_t)sizeof(uint32_t);
    if (allocSize > SIZE_MAX) {
        return ERROR_OUT_OF_RANGE;
    }
@@ -435,7 +435,7 @@ status_t SampleTable::setSyncSampleParams(off64_t data_offset, size_t data_size)
        ALOGV("Table of sync samples is empty or has only a single entry!");
    }

    uint64_t allocSize = mNumSyncSamples * sizeof(uint32_t);
    uint64_t allocSize = mNumSyncSamples * (uint64_t)sizeof(uint32_t);
    if (allocSize > SIZE_MAX) {
        return ERROR_OUT_OF_RANGE;
    }