mirror of https://github.com/mstorsjo/fdk-aac.git
[automerger] DO NOT MERGE MPEG-4 AAC Decoder: check against invalid height info am: 4a54666f3e
am: adc8026945
am: 6dd431c768
am: 4523eae489
Change-Id: I14943f95747e93f1e85cf560fe63fa11b168c9e3
This commit is contained in:
commit
b2d0afac05
|
@ -118,7 +118,9 @@ int CProgramConfig_IsValid ( const CProgramConfig *pPce )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read the extension for height info.
|
* 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
|
static
|
||||||
int CProgramConfig_ReadHeightExt(
|
int CProgramConfig_ReadHeightExt(
|
||||||
|
@ -146,15 +148,21 @@ int CProgramConfig_ReadHeightExt(
|
||||||
|
|
||||||
for (i=0; i < pPce->NumFrontChannelElements; i++)
|
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++)
|
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++)
|
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);
|
FDKbyteAlign(bs, alignmentAnchor);
|
||||||
|
|
||||||
|
@ -163,6 +171,13 @@ int CProgramConfig_ReadHeightExt(
|
||||||
/* CRC failed */
|
/* CRC failed */
|
||||||
err = -1;
|
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 {
|
else {
|
||||||
/* No valid extension data found -> restore the initial bitbuffer state */
|
/* No valid extension data found -> restore the initial bitbuffer state */
|
||||||
|
|
Loading…
Reference in New Issue