From b0017161d26e884cde7a88fa73f9d7d14fafaf8d Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Wed, 19 Jan 2011 13:51:28 +0100 Subject: Don't write into the OMX_SetParameter parameter data If called over the IOMX binder bridge, this parameter is a pointer to read only memory. If the updated value nBufferSize value is wanted, the caller should call OMX_GetParameter afterwards, which both Stagefright and OpenCORE do. Change-Id: I4c78114f4fe66c622501668bee336c94c8e0b900 --- mm-video/qdsp6/venc/omx/src/OMX_Venc.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mm-video/qdsp6/venc/omx/src/OMX_Venc.cpp b/mm-video/qdsp6/venc/omx/src/OMX_Venc.cpp index 10a87a63..25f8e2f1 100755 --- a/mm-video/qdsp6/venc/omx/src/OMX_Venc.cpp +++ b/mm-video/qdsp6/venc/omx/src/OMX_Venc.cpp @@ -1640,8 +1640,13 @@ OMX_ERRORTYPE Venc::update_param_port_fmt(OMX_IN OMX_VIDEO_PARAM_PORTFORMATTYPE* return result; } -OMX_ERRORTYPE Venc::update_param_port_def(OMX_IN OMX_PARAM_PORTDEFINITIONTYPE* pParam) +OMX_ERRORTYPE Venc::update_param_port_def(OMX_IN OMX_PARAM_PORTDEFINITIONTYPE* pOrigParam) { + // The code below tries to write to pParam - keep a local + // version instead of writing into the user specified data + // (which might be in read-only memory in some cases), and + // point pParam to that. + OMX_PARAM_PORTDEFINITIONTYPE localParam = *pOrigParam, *pParam = &localParam; OMX_ERRORTYPE result = OMX_ErrorNone; int rc = 0; if (pParam != NULL) -- cgit v1.2.3