diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2018-03-07 14:27:17 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2018-03-07 14:27:17 +0100 |
commit | 3eab23670d4d9fb2a8ee01c1be7b4acfc14c1552 (patch) | |
tree | 66307d4c7722477b8add1f133a84da311bb99470 /libMpegTPDec | |
parent | 89639e36b29a622c641c3de3a4737a4c848dc365 (diff) | |
parent | a30bfced6b6d6d976c728552d247cb30dd86e238 (diff) | |
download | fdk-aac-dabplus.tar.gz fdk-aac-dabplus.tar.bz2 fdk-aac-dabplus.zip |
Merge branch 'mstorjo/master' into dabplusHEADv0.1.6-dabdabplus
Diffstat (limited to 'libMpegTPDec')
-rw-r--r-- | libMpegTPDec/src/tpdec_adts.cpp | 3 | ||||
-rw-r--r-- | libMpegTPDec/src/tpdec_asc.cpp | 12 | ||||
-rw-r--r-- | libMpegTPDec/src/tpdec_lib.cpp | 2 |
3 files changed, 16 insertions, 1 deletions
diff --git a/libMpegTPDec/src/tpdec_adts.cpp b/libMpegTPDec/src/tpdec_adts.cpp index c455681..934fbc8 100644 --- a/libMpegTPDec/src/tpdec_adts.cpp +++ b/libMpegTPDec/src/tpdec_adts.cpp @@ -185,6 +185,9 @@ TRANSPORTDEC_ERROR adtsRead_DecodeHeader( #endif valBits = FDKgetValidBits(hBs); + if (valBits < ADTS_HEADERLENGTH) { + return TRANSPORTDEC_NOT_ENOUGH_BITS; + } /* adts_fixed_header */ bs.mpeg_id = FDKreadBits(hBs, Adts_Length_Id); diff --git a/libMpegTPDec/src/tpdec_asc.cpp b/libMpegTPDec/src/tpdec_asc.cpp index 96a1b35..a292bcb 100644 --- a/libMpegTPDec/src/tpdec_asc.cpp +++ b/libMpegTPDec/src/tpdec_asc.cpp @@ -650,6 +650,8 @@ int CProgramConfig_LookupElement( /* search in front channels */ for (i = 0; i < pPce->NumFrontChannelElements; i++) { int heightLayer = pPce->FrontElementHeightInfo[i]; + if (heightLayer >= PC_NUM_HEIGHT_LAYER) + return 0; if (isCpe == pPce->FrontElementIsCpe[i] && pPce->FrontElementTagSelect[i] == tag) { int h, elIdx = ec[heightLayer], chIdx = cc[heightLayer]; AUDIO_CHANNEL_TYPE aChType = (AUDIO_CHANNEL_TYPE)((heightLayer<<4) | ACT_FRONT); @@ -704,6 +706,8 @@ int CProgramConfig_LookupElement( /* search in side channels */ for (i = 0; i < pPce->NumSideChannelElements; i++) { int heightLayer = pPce->SideElementHeightInfo[i]; + if (heightLayer >= PC_NUM_HEIGHT_LAYER) + return 0; if (isCpe == pPce->SideElementIsCpe[i] && pPce->SideElementTagSelect[i] == tag) { int h, elIdx = ec[heightLayer], chIdx = cc[heightLayer]; AUDIO_CHANNEL_TYPE aChType = (AUDIO_CHANNEL_TYPE)((heightLayer<<4) | ACT_SIDE); @@ -758,6 +762,8 @@ int CProgramConfig_LookupElement( /* search in back channels */ for (i = 0; i < pPce->NumBackChannelElements; i++) { int heightLayer = pPce->BackElementHeightInfo[i]; + if (heightLayer >= PC_NUM_HEIGHT_LAYER) + return 0; if (isCpe == pPce->BackElementIsCpe[i] && pPce->BackElementTagSelect[i] == tag) { int h, elIdx = ec[heightLayer], chIdx = cc[heightLayer]; AUDIO_CHANNEL_TYPE aChType = (AUDIO_CHANNEL_TYPE)((heightLayer<<4) | ACT_BACK); @@ -817,18 +823,24 @@ int CProgramConfig_LookupElement( Start with counting the front channels/elements at normal height */ for (i = 0; i < pPce->NumFrontChannelElements; i+=1) { int heightLayer = pPce->FrontElementHeightInfo[i]; + if (heightLayer >= PC_NUM_HEIGHT_LAYER) + return 0; ec[heightLayer] += 1; cc[heightLayer] += (pPce->FrontElementIsCpe[i]) ? 2 : 1; } /* Count side channels/elements at normal height */ for (i = 0; i < pPce->NumSideChannelElements; i+=1) { int heightLayer = pPce->SideElementHeightInfo[i]; + if (heightLayer >= PC_NUM_HEIGHT_LAYER) + return 0; ec[heightLayer] += 1; cc[heightLayer] += (pPce->SideElementIsCpe[i]) ? 2 : 1; } /* Count back channels/elements at normal height */ for (i = 0; i < pPce->NumBackChannelElements; i+=1) { int heightLayer = pPce->BackElementHeightInfo[i]; + if (heightLayer >= PC_NUM_HEIGHT_LAYER) + return 0; ec[heightLayer] += 1; cc[heightLayer] += (pPce->BackElementIsCpe[i]) ? 2 : 1; } diff --git a/libMpegTPDec/src/tpdec_lib.cpp b/libMpegTPDec/src/tpdec_lib.cpp index 24f755b..5760752 100644 --- a/libMpegTPDec/src/tpdec_lib.cpp +++ b/libMpegTPDec/src/tpdec_lib.cpp @@ -342,7 +342,7 @@ TRANSPORTDEC_ERROR transportDec_FillData( } } else { /* ... else feed bitbuffer with new stream data (append). */ - if (hTp->numberOfRawDataBlocks <= 0) { + if ((hTp->numberOfRawDataBlocks <= 0) || (FDKgetValidBits(hBs)==0)) { FDKfeedBuffer (hBs, pBuffer, bufferSize, pBytesValid) ; } } |