fixed overflow issue that can have out of range as conditional expression
[platform/adaptation/ap_samsung/libomxil-e3250-v4l2.git] / openmax / component / video / dec / mpeg2 / Exynos_OMX_Mpeg2dec.c
index 3ae55f5..4dd0d91 100755 (executable)
@@ -1583,12 +1583,12 @@ OMX_ERRORTYPE Exynos_Mpeg2Dec_SrcOut(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OM
         if ((pExynosInputPort->bufferProcessType & BUFFER_COPY) == BUFFER_COPY) {
             int i = 0;
             while (pSrcOutputData->buffer.singlePlaneBuffer.dataBuffer != pVideoDec->pMFCDecInputBuffer[i]->pVirAddr[0]) {
+                i++;
                 if (i >= MFC_INPUT_BUFFER_NUM_MAX) {
                     Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Can not find buffer");
                     ret = (OMX_ERRORTYPE)OMX_ErrorCodecDecode;
                     goto EXIT;
                 }
-                i++;
             }
             pVideoDec->pMFCDecInputBuffer[i]->dataSize = 0;
             pSrcOutputData->pPrivate = pVideoDec->pMFCDecInputBuffer[i];