aboutsummaryrefslogtreecommitdiffstats
path: root/libMpegTPDec
diff options
context:
space:
mode:
authorAndroid Build Merger (Role) <noreply-android-build-merger@google.com>2018-01-31 19:48:30 +0000
committerAndroid Build Merger (Role) <noreply-android-build-merger@google.com>2018-01-31 19:48:30 +0000
commitadc8026945d797d0c5cf3708fca635ad61c87c32 (patch)
tree9f8387ab2b677a35ba75ec85979cd3f377fa32ba /libMpegTPDec
parente1d517a90997840f88bf97bef3f07bd7aca987c1 (diff)
parent4a54666f3ebd44dbf9c6ef575c0e036eb5e75e0d (diff)
downloadfdk-aac-adc8026945d797d0c5cf3708fca635ad61c87c32.tar.gz
fdk-aac-adc8026945d797d0c5cf3708fca635ad61c87c32.tar.bz2
fdk-aac-adc8026945d797d0c5cf3708fca635ad61c87c32.zip
[automerger] DO NOT MERGE MPEG-4 AAC Decoder: check against invalid height info am: 4a54666f3e
Change-Id: If7874381cdfce6cced128082b35cbd6ab21f709d
Diffstat (limited to 'libMpegTPDec')
-rw-r--r--libMpegTPDec/src/tpdec_asc.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/libMpegTPDec/src/tpdec_asc.cpp b/libMpegTPDec/src/tpdec_asc.cpp
index bae271e..e697b48 100644
--- a/libMpegTPDec/src/tpdec_asc.cpp
+++ b/libMpegTPDec/src/tpdec_asc.cpp
@@ -118,7 +118,9 @@ int CProgramConfig_IsValid ( const CProgramConfig *pPce )
/*
* Read the extension for height info.
- * return 0 if successfull or -1 if the CRC failed.
+ * return 0 if successfull,
+ * -1 if the CRC failed,
+ * -2 if invalid HeightInfo.
*/
static
int CProgramConfig_ReadHeightExt(
@@ -146,15 +148,21 @@ int CProgramConfig_ReadHeightExt(
for (i=0; i < pPce->NumFrontChannelElements; i++)
{
- pPce->FrontElementHeightInfo[i] = (UCHAR) FDKreadBits(bs,2);
+ if ((pPce->FrontElementHeightInfo[i] = (UCHAR) FDKreadBits(bs,2)) >= PC_NUM_HEIGHT_LAYER) {
+ err = -2; /* height information is out of the valid range */
+ }
}
for (i=0; i < pPce->NumSideChannelElements; i++)
{
- pPce->SideElementHeightInfo[i] = (UCHAR) FDKreadBits(bs,2);
+ if ((pPce->SideElementHeightInfo[i] = (UCHAR) FDKreadBits(bs,2)) >= PC_NUM_HEIGHT_LAYER) {
+ err = -2; /* height information is out of the valid range */
+ }
}
for (i=0; i < pPce->NumBackChannelElements; i++)
{
- pPce->BackElementHeightInfo[i] = (UCHAR) FDKreadBits(bs,2);
+ if ((pPce->BackElementHeightInfo[i] = (UCHAR) FDKreadBits(bs,2)) >= PC_NUM_HEIGHT_LAYER) {
+ err = -2; /* height information is out of the valid range */
+ }
}
FDKbyteAlign(bs, alignmentAnchor);
@@ -163,6 +171,13 @@ int CProgramConfig_ReadHeightExt(
/* CRC failed */
err = -1;
}
+ if (err!=0) {
+ /* Reset whole height information in case an error occured during parsing. The return
+ value ensures that pPce->isValid is set to 0 and implicit channel mapping is used. */
+ FDKmemclear(pPce->FrontElementHeightInfo, sizeof(pPce->FrontElementHeightInfo));
+ FDKmemclear(pPce->SideElementHeightInfo, sizeof(pPce->SideElementHeightInfo));
+ FDKmemclear(pPce->BackElementHeightInfo, sizeof(pPce->BackElementHeightInfo));
+ }
}
else {
/* No valid extension data found -> restore the initial bitbuffer state */