History

Add protection for wrong API call without initialize

Haibo Zhu committed 10 years ago

Commit 6d7bd2d1 parent 91fa9fa1 file · +14 −0Browse files

Showing the changes to codec/decoder/plus/src/welsDecoderExt.cpp (1 of 1 file). Show all

Unified · Split

codec/decoder/plus/src/welsDecoderExt.cpp+14−0
@@ -444,6 +444,13 @@ DECODING_STATE CWelsDecoder::DecodeFrame2 (const unsigned char* kpSrc, · 443 unmodified lines
444 const int kiSrcLen,444 const int kiSrcLen,
445 unsigned char** ppDst,445 unsigned char** ppDst,
446 SBufferInfo* pDstInfo) {446 SBufferInfo* pDstInfo) {
447 if (m_pDecContext == NULL || m_pDecContext->pParam == NULL) {
448 if (m_pWelsTrace != NULL) {
449 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "Call DecodeFrame2 without Initialize.\n");
450 }
451 return dsInitialOptExpected;
452 }
453
447 if (m_pDecContext->pParam->bParseOnly) {454 if (m_pDecContext->pParam->bParseOnly) {
448 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "bParseOnly should be false for this API calling! \n");455 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "bParseOnly should be false for this API calling! \n");
449 m_pDecContext->iErrorCode |= dsInvalidArgument;456 m_pDecContext->iErrorCode |= dsInvalidArgument;
@@ -589,6 +596,13 @@ DECODING_STATE CWelsDecoder::DecodeFrame2 (const unsigned char* kpSrc, · 139 unmodified lines
589DECODING_STATE CWelsDecoder::DecodeParser (const unsigned char* kpSrc,596DECODING_STATE CWelsDecoder::DecodeParser (const unsigned char* kpSrc,
590 const int kiSrcLen,597 const int kiSrcLen,
591 SParserBsInfo* pDstInfo) {598 SParserBsInfo* pDstInfo) {
599 if (m_pDecContext == NULL || m_pDecContext->pParam == NULL) {
600 if (m_pWelsTrace != NULL) {
601 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "Call DecodeParser without Initialize.\n");
602 }
603 return dsInitialOptExpected;
604 }
605
592 if (!m_pDecContext->pParam->bParseOnly) {606 if (!m_pDecContext->pParam->bParseOnly) {
593 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "bParseOnly should be true for this API calling! \n");607 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "bParseOnly should be true for this API calling! \n");
594 m_pDecContext->iErrorCode |= dsInvalidArgument;608 m_pDecContext->iErrorCode |= dsInvalidArgument;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t