diff options
author | Android Build Merger (Role) <noreply-android-build-merger@google.com> | 2018-02-01 18:00:19 +0000 |
---|---|---|
committer | Android Build Merger (Role) <noreply-android-build-merger@google.com> | 2018-02-01 18:00:19 +0000 |
commit | c2fe4b944b9a32f77032236744cc43a408d3db91 (patch) | |
tree | 9a462214e59fc75845e18f41b94036a3c34c1ea0 | |
parent | 2494f9fa123d67da3964f398d3fee2ad1348426b (diff) | |
parent | 243be669b33513ca40634cc9df2466dbfd40e7f8 (diff) | |
download | fdk-aac-c2fe4b944b9a32f77032236744cc43a408d3db91.tar.gz fdk-aac-c2fe4b944b9a32f77032236744cc43a408d3db91.tar.bz2 fdk-aac-c2fe4b944b9a32f77032236744cc43a408d3db91.zip |
[automerger] DO NOT MERGE MPEG-4 AAC Decoder: check against invalid height info am: 31447431fe am: fce9663d6f am: 658a02f977 am: 243be669b3
Change-Id: Ia27f928400ceed95b6704b7b602968dbc14714e4
-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 */ |