diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2018-01-14 08:44:34 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2018-01-14 08:44:34 +0000 |
commit | 626d5345e258b79634ab6a3eb1eb50a3005c482c (patch) | |
tree | 57451030abf3be4b2ae2a091bbcc0c05502c2090 /libMpegTPDec | |
parent | 38167553d60a95338bb44c11491a1d646fb48dbc (diff) | |
parent | 82e17d87f061014b3c07140fafe78eaaf2fbe39d (diff) | |
download | fdk-aac-626d5345e258b79634ab6a3eb1eb50a3005c482c.tar.gz fdk-aac-626d5345e258b79634ab6a3eb1eb50a3005c482c.tar.bz2 fdk-aac-626d5345e258b79634ab6a3eb1eb50a3005c482c.zip |
Snap for 4545621 from 82e17d87f061014b3c07140fafe78eaaf2fbe39d to pi-release
Change-Id: Ia2910df2b1395c73d6a693199ae38aea499630a7
Diffstat (limited to 'libMpegTPDec')
-rw-r--r-- | libMpegTPDec/src/tpdec_asc.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/libMpegTPDec/src/tpdec_asc.cpp b/libMpegTPDec/src/tpdec_asc.cpp index 96a1b35..e80d0e5 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 */ |