From c58721cbdcbfc46f550954a1c258d9b0529e4d81 Mon Sep 17 00:00:00 2001 From: Dheeraj CVR Date: Mon, 17 Jun 2013 09:21:42 +0530 Subject: libstagefright: fix indefinate loop in QueryCodec portFormat.nIndex is being incremented which is not trustworthy since the nIndex value could be overriden by the OMX Component, which causes an indefinate loop which inturn causes a memory leak and crashes the system. OMX Component on encore and p970 exhibits this behaviour (OMX.TI.720P.Decoder). This patch prevents stagefright freezes when QueryCodec is called during Gallery Thumbnail generation for videos and Adobe Flash playback. Change-Id: I825c99ddecacbb927e22ac7d1a53facb26d95ff2 --- media/libstagefright/OMXCodec.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp index c7b4617..efb5f26 100644 --- a/media/libstagefright/OMXCodec.cpp +++ b/media/libstagefright/OMXCodec.cpp @@ -5433,7 +5433,8 @@ status_t QueryCodec( OMX_VIDEO_PARAM_PORTFORMATTYPE portFormat; InitOMXParams(&portFormat); portFormat.nPortIndex = !isEncoder ? 1 : 0; - for (portFormat.nIndex = 0;; ++portFormat.nIndex) { + for (OMX_U32 index = 0;;index++) { + portFormat.nIndex = index; err = omx->getParameter( node, OMX_IndexParamVideoPortFormat, &portFormat, sizeof(portFormat)); -- cgit v1.1