Merge "Fix not properly handled NULL-pointer access before check in aac lib"

This commit is contained in:
Treehugger Robot 2017-02-23 21:25:44 +00:00 committed by Gerrit Code Review
commit b0af861f5a
2 changed files with 10 additions and 19 deletions

View File

@ -791,36 +791,29 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecoder_DecodeFrame(
const UINT flags) const UINT flags)
{ {
AAC_DECODER_ERROR ErrorStatus; AAC_DECODER_ERROR ErrorStatus;
INT layer;
INT nBits;
INT interleaved = self->outputInterleaved;
HANDLE_FDK_BITSTREAM hBs;
int fTpInterruption = 0; /* Transport originated interruption detection. */ int fTpInterruption = 0; /* Transport originated interruption detection. */
int fTpConceal = 0; /* Transport originated concealment. */ int fTpConceal = 0; /* Transport originated concealment. */
INT_PCM *pTimeData = NULL;
INT timeDataSize = 0;
if (self == NULL) { if (self == NULL) {
return AAC_DEC_INVALID_HANDLE; return AAC_DEC_INVALID_HANDLE;
} }
INT interleaved = self->outputInterleaved;
pTimeData = self->pcmOutputBuffer; INT_PCM *pTimeData = self->pcmOutputBuffer;
timeDataSize = sizeof(self->pcmOutputBuffer)/sizeof(*self->pcmOutputBuffer); INT timeDataSize = sizeof(self->pcmOutputBuffer)/sizeof(*self->pcmOutputBuffer);
if (flags & AACDEC_INTR) { if (flags & AACDEC_INTR) {
self->streamInfo.numLostAccessUnits = 0; self->streamInfo.numLostAccessUnits = 0;
} }
hBs = transportDec_GetBitstream(self->hInput, 0); HANDLE_FDK_BITSTREAM hBs = transportDec_GetBitstream(self->hInput, 0);
/* Get current bits position for bitrate calculation. */ /* Get current bits position for bitrate calculation. */
nBits = FDKgetValidBits(hBs); INT nBits = FDKgetValidBits(hBs);
if (! (flags & (AACDEC_CONCEAL | AACDEC_FLUSH) ) ) if (! (flags & (AACDEC_CONCEAL | AACDEC_FLUSH) ) )
{ {
TRANSPORTDEC_ERROR err; TRANSPORTDEC_ERROR err;
for(layer = 0; layer < self->nrOfLayers; layer++) for(INT layer = 0; layer < self->nrOfLayers; layer++)
{ {
err = transportDec_ReadAccessUnit(self->hInput, layer); err = transportDec_ReadAccessUnit(self->hInput, layer);
if (err != TRANSPORTDEC_OK) { if (err != TRANSPORTDEC_OK) {

View File

@ -488,14 +488,12 @@ static FDK_METADATA_ERROR ProcessCompressor(
{ {
FDK_METADATA_ERROR err = METADATA_OK; FDK_METADATA_ERROR err = METADATA_OK;
INT dynrng, compr;
DRC_PROFILE profileDrc = convertProfile(pMetadata->mpegDrc.drc_profile);
DRC_PROFILE profileComp = convertProfile(pMetadata->etsiAncData.comp_profile);
if ( (pMetadata==NULL) || (hDrcComp==NULL) ) { if ( (pMetadata==NULL) || (hDrcComp==NULL) ) {
err = METADATA_INVALID_HANDLE; err = METADATA_INVALID_HANDLE;
return err; return err;
} }
DRC_PROFILE profileDrc = convertProfile(pMetadata->mpegDrc.drc_profile);
DRC_PROFILE profileComp = convertProfile(pMetadata->etsiAncData.comp_profile);
/* first, check if profile is same as last frame /* first, check if profile is same as last frame
* otherwise, update setup */ * otherwise, update setup */
@ -511,8 +509,8 @@ static FDK_METADATA_ERROR ProcessCompressor(
} }
/* in case of embedding external values, copy this now (limiter may overwrite them) */ /* in case of embedding external values, copy this now (limiter may overwrite them) */
dynrng = decodeDynrng(pMetadata->mpegDrc.dyn_rng_ctl[0], pMetadata->mpegDrc.dyn_rng_sgn[0]); INT dynrng = decodeDynrng(pMetadata->mpegDrc.dyn_rng_ctl[0], pMetadata->mpegDrc.dyn_rng_sgn[0]);
compr = decodeCompr(pMetadata->etsiAncData.compression_value); INT compr = decodeCompr(pMetadata->etsiAncData.compression_value);
/* Call compressor */ /* Call compressor */
if (FDK_DRC_Generator_Calc(hDrcComp, if (FDK_DRC_Generator_Calc(hDrcComp,