From 553a7a54b12af58aaf776692247fbf88b5a06e5d Mon Sep 17 00:00:00 2001 From: Weian Chen Date: Fri, 11 Oct 2013 07:26:42 -0700 Subject: [PORT FROM R42-TW]omx-component: avoid crash when caller passes NULL parameter to GetDecoderOutputCrop() BZ: 144625 Add parameter check for GetDecoderOutputCrop() to avoid crash, when the uplayer caller passes in the NULL pointer Add check for function SetDecoderRotation() also. Change-Id: I894446e0a8f8c57ac8defdc6fc52d9ecdd2aca7b Orig-Change-Id: I8a074d93a3784049765a0c5c7d881b00067b2b91 Signed-off-by: Weian Chen Signed-off-by: Dan Liang --- videocodec/OMXVideoDecoderBase.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'videocodec/OMXVideoDecoderBase.cpp') diff --git a/videocodec/OMXVideoDecoderBase.cpp b/videocodec/OMXVideoDecoderBase.cpp index 0a60aef..a4dbe63 100755 --- a/videocodec/OMXVideoDecoderBase.cpp +++ b/videocodec/OMXVideoDecoderBase.cpp @@ -823,14 +823,22 @@ OMX_ERRORTYPE OMXVideoDecoderBase::SetDecoderRotation(OMX_PTR pStructure) { CHECK_SET_PARAM_STATE(); int32_t rotationDegrees = 0; - rotationDegrees = *(static_cast(pStructure)); - mRotationDegrees = rotationDegrees; + if (pStructure) { + rotationDegrees = *(static_cast(pStructure)); + mRotationDegrees = rotationDegrees; - return OMX_ErrorNone; + return OMX_ErrorNone; + } else + return OMX_ErrorBadParameter; } OMX_ERRORTYPE OMXVideoDecoderBase::GetDecoderOutputCrop(OMX_PTR pStructure) { + + OMX_ERRORTYPE ret; OMX_CONFIG_RECTTYPE *rectParams = (OMX_CONFIG_RECTTYPE *)pStructure; + + CHECK_TYPE_HEADER(rectParams); + if (rectParams->nPortIndex != OUTPORT_INDEX) { return OMX_ErrorUndefined; } -- cgit v1.2.3