[vlc-commits] iomx: fix mediaserver crash with QCOM devices.

Thomas Guillem git at videolan.org
Fri Jul 4 18:56:29 CEST 2014


vlc/vlc-2.2 | branch: master | Thomas Guillem <guillem at archos.com> | Thu Jul  3 17:11:59 2014 +0200| [cd69efe60feed1cf9a1b5a233ecb7d3d73d7e110] | committer: Jean-Baptiste Kempf

iomx: fix mediaserver crash with QCOM devices.

Some QCOM OMX_getParameter implementations override the nSize element to a bad
value. This can lead to a mediaserver crash because IOMX interface rely on
nSize to send the OMX parameter via android Binder.

Signed-off-by: Martin Storsjö <martin at martin.st>
(cherry picked from commit ec8bf9d655a8d5d1b399dfe1dcd1219aee3e697b)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=cd69efe60feed1cf9a1b5a233ecb7d3d73d7e110
---

 modules/codec/omxil/iomx.cpp |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/modules/codec/omxil/iomx.cpp b/modules/codec/omxil/iomx.cpp
index b399018..c4c4ac6 100644
--- a/modules/codec/omxil/iomx.cpp
+++ b/modules/codec/omxil/iomx.cpp
@@ -133,8 +133,17 @@ static OMX_ERRORTYPE iomx_send_command(OMX_HANDLETYPE component, OMX_COMMANDTYPE
 
 static OMX_ERRORTYPE iomx_get_parameter(OMX_HANDLETYPE component, OMX_INDEXTYPE param_index, OMX_PTR param)
 {
+    /*
+     * Some QCOM OMX_getParameter implementations override the nSize element to
+     * a bad value. So, save the initial nSize in order to restore it after.
+     */
+    OMX_U32 nSize = *(OMX_U32*)param;
+    OMX_ERRORTYPE error;
     OMXNode* node = (OMXNode*) ((OMX_COMPONENTTYPE*)component)->pComponentPrivate;
-    return get_error(ctx->iomx->getParameter(node->node, param_index, param, *(OMX_U32*)param));
+
+    error = get_error(ctx->iomx->getParameter(node->node, param_index, param, nSize));
+    *(OMX_U32*)param = nSize;
+    return error;
 }
 
 static OMX_ERRORTYPE iomx_set_parameter(OMX_HANDLETYPE component, OMX_INDEXTYPE param_index, OMX_PTR param)



More information about the vlc-commits mailing list