Loading media/libstagefright/codecs/avc/enc/SoftAVCEncoder.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -244,6 +244,10 @@ OMX_ERRORTYPE SoftAVCEncoder::initEncParams() { if (mColorFormat != OMX_COLOR_FormatYUV420Planar || mInputDataIsMeta) { // Color conversion is needed. free(mInputFrameData); if (((uint64_t)mVideoWidth * mVideoHeight) > ((uint64_t)INT32_MAX / 3)) { ALOGE("Buffer size is too big."); return OMX_ErrorUndefined; } mInputFrameData = (uint8_t *) malloc((mWidth * mHeight * 3 ) >> 1); CHECK(mInputFrameData != NULL); Loading @@ -264,6 +268,10 @@ OMX_ERRORTYPE SoftAVCEncoder::initEncParams() { int32_t nMacroBlocks = divUp(mWidth, 16) * divUp(mHeight, 16); CHECK(mSliceGroup == NULL); if (nMacroBlocks > SIZE_MAX / sizeof(uint32_t)) { ALOGE("requested memory size is too big."); return OMX_ErrorUndefined; } mSliceGroup = (uint32_t *) malloc(sizeof(uint32_t) * nMacroBlocks); CHECK(mSliceGroup != NULL); for (int ii = 0, idx = 0; ii < nMacroBlocks; ++ii) { Loading Loading
media/libstagefright/codecs/avc/enc/SoftAVCEncoder.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -244,6 +244,10 @@ OMX_ERRORTYPE SoftAVCEncoder::initEncParams() { if (mColorFormat != OMX_COLOR_FormatYUV420Planar || mInputDataIsMeta) { // Color conversion is needed. free(mInputFrameData); if (((uint64_t)mVideoWidth * mVideoHeight) > ((uint64_t)INT32_MAX / 3)) { ALOGE("Buffer size is too big."); return OMX_ErrorUndefined; } mInputFrameData = (uint8_t *) malloc((mWidth * mHeight * 3 ) >> 1); CHECK(mInputFrameData != NULL); Loading @@ -264,6 +268,10 @@ OMX_ERRORTYPE SoftAVCEncoder::initEncParams() { int32_t nMacroBlocks = divUp(mWidth, 16) * divUp(mHeight, 16); CHECK(mSliceGroup == NULL); if (nMacroBlocks > SIZE_MAX / sizeof(uint32_t)) { ALOGE("requested memory size is too big."); return OMX_ErrorUndefined; } mSliceGroup = (uint32_t *) malloc(sizeof(uint32_t) * nMacroBlocks); CHECK(mSliceGroup != NULL); for (int ii = 0, idx = 0; ii < nMacroBlocks; ++ii) { Loading