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

Commit 3a75f043 authored by Pawin Vongmasa's avatar Pawin Vongmasa
Browse files

Prevent setStartTimeUs from integer overflow

Test: make cts -j123 && cts-tradefed run cts-dev -m \
CtsMediaTestCases --compatibility:module-arg \
CtsMediaTestCases:include-annotation:\
android.platform.test.annotations.RequiresDevice

Bug: 64227921
Change-Id: I06f59ddf3ce12b46c046eb4de852ee4e11545d9f
parent ef9fc779
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1199,7 +1199,8 @@ status_t GraphicBufferSource::setStartTimeUs(int64_t skipFramesBeforeUs) {
    Mutex::Autolock autoLock(mMutex);

    mSkipFramesBeforeNs =
            (skipFramesBeforeUs > 0) ? (skipFramesBeforeUs * 1000) : -1ll;
            (skipFramesBeforeUs > 0 && skipFramesBeforeUs <= INT64_MAX / 1000) ?
            (skipFramesBeforeUs * 1000) : -1ll;

    return OK;
}