Showing the changes to codec/decoder/core/src/decoder.cpp (1 of 1 file). Show all
Unified · Split
| @@ -669,10 +669,15 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in · 668 unmodified lines | ||
| 669 | 669 | (0 == LD16 (pSrcNal + iSrcIdx)) && |
| 670 | 670 | ((pSrcNal[2 + iSrcIdx] == 0x03) || (pSrcNal[2 + iSrcIdx] == 0x01))) { |
| 671 | 671 | if (pSrcNal[2 + iSrcIdx] == 0x03) { |
| 672 | − ST16 (pDstNal + iDstIdx, 0); | |
| 673 | − iDstIdx += 2; | |
| 674 | − iSrcIdx += 3; | |
| 675 | − iSrcConsumed += 3; | |
| 672 | + if ((3 + iSrcConsumed < iSrcLength) && pSrcNal[3 + iSrcIdx] > 0x03) { | |
| 673 | + pCtx->iErrorCode |= dsBitstreamError; | |
| 674 | + return pCtx->iErrorCode; | |
| 675 | + } else { | |
| 676 | + ST16 (pDstNal + iDstIdx, 0); | |
| 677 | + iDstIdx += 2; | |
| 678 | + iSrcIdx += 3; | |
| 679 | + iSrcConsumed += 3; | |
| 680 | + } | |
| 676 | 681 | } else { |
| 677 | 682 | |
| 678 | 683 | iConsumedBytes = 0; |