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

Commit cd59f03d authored by Harish Mahendrakar's avatar Harish Mahendrakar
Browse files

Codec2BufferUtils.cpp: Fix integer-overflows

Fix integer overflows in IsNV12 and IsNV21

Bug: 185277572
Test: atest VtsHalMediaC2V1_0TargetVideoEncTest

Change-Id: I940456cf7f26696f42d885531b0b73d064de921e
parent d22cd941
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -346,7 +346,7 @@ bool IsNV12(const MediaImage2 *img) {
    }
    return (img->mPlane[1].mColInc == 2
            && img->mPlane[2].mColInc == 2
            && (img->mPlane[2].mOffset - img->mPlane[1].mOffset == 1));
            && (img->mPlane[2].mOffset == img->mPlane[1].mOffset + 1));
}

bool IsNV21(const MediaImage2 *img) {
@@ -355,7 +355,7 @@ bool IsNV21(const MediaImage2 *img) {
    }
    return (img->mPlane[1].mColInc == 2
            && img->mPlane[2].mColInc == 2
            && (img->mPlane[1].mOffset - img->mPlane[2].mOffset == 1));
            && (img->mPlane[1].mOffset == img->mPlane[2].mOffset + 1));
}

bool IsI420(const MediaImage2 *img) {