History

Add protection about emulation_prevention_three_byte error bytes

Haibo Zhu committed 11 years ago

Commit e90068c1 parent 6ba10ce1 file · +9 −4Browse files

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

Unified · Split

codec/decoder/core/src/decoder.cpp+9−4
@@ -669,10 +669,15 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in · 668 unmodified lines
669669 (0 == LD16 (pSrcNal + iSrcIdx)) &&
670670 ((pSrcNal[2 + iSrcIdx] == 0x03) || (pSrcNal[2 + iSrcIdx] == 0x01))) {
671671 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+ }
676681 } else {
677682
678683 iConsumedBytes = 0;

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