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

Commit a63a7a4e authored by Marco Nelissen's avatar Marco Nelissen Committed by Android (Google) Code Review
Browse files

Merge "Fix potential overflow"

parents 31967c23 fcd1022c
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -1052,8 +1052,9 @@ status_t MediaCodec::configure(
        }

        // Prevent possible integer overflow in downstream code.
        if ((uint64_t)mVideoWidth * mVideoHeight > (uint64_t)INT32_MAX / 4) {
            ALOGE("buffer size is too big, width=%d, height=%d", mVideoWidth, mVideoHeight);
        if (mVideoWidth < 0 || mVideoHeight < 0 ||
               (uint64_t)mVideoWidth * mVideoHeight > (uint64_t)INT32_MAX / 4) {
            ALOGE("Invalid size(s), width=%d, height=%d", mVideoWidth, mVideoHeight);
            return BAD_VALUE;
        }
    }