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

Commit e1a64b9f authored by Aayush Soni's avatar Aayush Soni Committed by Ray Essick
Browse files

mpeg4enc: update resolution check

Updated resolution check to limit encoder to 2048x2048

Bug: 190435883

Test: POC in bug descriptions

Change-Id: I749a9a3fda0924c17b3a4ddfb1c6402d2ce8552f
parent eaa689fd
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -610,18 +610,19 @@ OSCL_EXPORT_REF Bool PVInitVideoEncoder(VideoEncControls *encoderControl, Vid
    /* Find the maximum width*height for memory allocation of the VOPs */
    for (idx = 0; idx < nLayers; idx++)
    {
        temp_w = video->encParams->LayerWidth[idx];
        temp_h = video->encParams->LayerHeight[idx];
        temp_w = ((video->encParams->LayerWidth[idx] + 15) >> 4) << 4;
        temp_h = ((video->encParams->LayerHeight[idx] + 15) >> 4) << 4;

        if (temp_w > 2048 || temp_h > 2048) {
            goto CLEAN_UP;
        }

        if ((temp_w*temp_h) > max)
        {
            max = temp_w * temp_h;
            max_width = ((temp_w + 15) >> 4) << 4;
            max_height = ((temp_h + 15) >> 4) << 4;
            if (((uint64_t)max_width * max_height) > (uint64_t)INT32_MAX
                    || temp_w > INT32_MAX - 15 || temp_h > INT32_MAX - 15) {
                goto CLEAN_UP;
            }
            max_width = temp_w;
            max_height = temp_h;

            nTotalMB = ((max_width * max_height) >> 8);
        }