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

Commit fd9b8091 authored by Taehwan Kim's avatar Taehwan Kim Committed by Wonsik Kim
Browse files

CCodec: fix underflow issue on handleImageData



the logic is assumed that gralloc does assume a contiguous mapping
at GraphicView2MediaImageConverter() in Codec2Buffer.
if it doesn't, underflow could happen because
type of variable is unsigned.

Bug: 168757280

Change-Id: I04e13d0680af74e76d96d3ab10a549f6368205cf
Signed-off-by: default avatarTaehwan Kim <t_h.kim@samsung.com>
parent d5a46a87
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -91,7 +91,9 @@ void CCodecBuffers::handleImageData(const sp<Codec2Buffer> &buffer) {
            newFormat->setInt32(KEY_STRIDE, stride);
            ALOGD("[%s] updating stride = %d", mName, stride);
            if (img->mNumPlanes > 1 && stride > 0) {
                int32_t vstride = (img->mPlane[1].mOffset - img->mPlane[0].mOffset) / stride;
                int64_t offsetDelta =
                    (int64_t)img->mPlane[1].mOffset - (int64_t)img->mPlane[0].mOffset;
                int32_t vstride = int32_t(offsetDelta / stride);
                newFormat->setInt32(KEY_SLICE_HEIGHT, vstride);
                ALOGD("[%s] updating vstride = %d", mName, vstride);
            }