exynos_omx: check pointer before use to workaround potential crash.
authorRonghua Wu <ronghuawu@google.com>
Fri, 19 Dec 2014 21:53:19 +0000 (13:53 -0800)
committerRonghua Wu <ronghuawu@google.com>
Fri, 19 Dec 2014 21:53:19 +0000 (13:53 -0800)
Bug: 18639414
Change-Id: Ia603736d4c81488cc9772ce0cf7b253f2932a2b4

exynos_omx/codecs/exynos_codecs/video/exynos5/mfc_v4l2/dec/src/ExynosVideoDecoder.c

index a456a2be231fdb8ec2704d660eb5db31aba0efae..48e152fe66259abf5a86ffa64708903c27d7faac 100644 (file)
@@ -1483,7 +1483,9 @@ static ExynosVideoErrorType MFC_Decoder_Enqueue_Inbuf(
             buf.m.planes[i].bytesused = dataSize[i];
     }
 
-    if ((((OMX_BUFFERHEADERTYPE *)pPrivate)->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
+    // FIXME: figure out why |pPrivate| may be NULL.
+    if (pPrivate &&
+            (((OMX_BUFFERHEADERTYPE *)pPrivate)->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
         buf.flags |= V4L2_BUF_FLAG_LAST_FRAME;
         ALOGV("%s: OMX_BUFFERFLAG_EOS => LAST_FRAME: 0x%x", __func__,
               !!(buf.flags & V4L2_BUF_FLAG_LAST_FRAME));