1
0
mirror of https://github.com/mstorsjo/fdk-aac.git synced 2025-06-05 22:39:13 +02:00

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

1) Fixes some potential NULL-pointer access in case input pointer is
passed NULL
2) Modified some for lazy init

Test: mm -j 8
Change-Id: I7fca97e1d9f70d8e8c1533b519181af35a5468f7
This commit is contained in:
liuchao
2017-02-23 12:05:54 +08:00
parent b82c85d0b1
commit 64bd48e21b
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)
{
AAC_DECODER_ERROR ErrorStatus;
INT layer;
INT nBits;
INT interleaved = self->outputInterleaved;
HANDLE_FDK_BITSTREAM hBs;
int fTpInterruption = 0; /* Transport originated interruption detection. */
int fTpConceal = 0; /* Transport originated concealment. */
INT_PCM *pTimeData = NULL;
INT timeDataSize = 0;
if (self == NULL) {
return AAC_DEC_INVALID_HANDLE;
}
pTimeData = self->pcmOutputBuffer;
timeDataSize = sizeof(self->pcmOutputBuffer)/sizeof(*self->pcmOutputBuffer);
INT interleaved = self->outputInterleaved;
INT_PCM *pTimeData = self->pcmOutputBuffer;
INT timeDataSize = sizeof(self->pcmOutputBuffer)/sizeof(*self->pcmOutputBuffer);
if (flags & AACDEC_INTR) {
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. */
nBits = FDKgetValidBits(hBs);
INT nBits = FDKgetValidBits(hBs);
if (! (flags & (AACDEC_CONCEAL | AACDEC_FLUSH) ) )
{
TRANSPORTDEC_ERROR err;
for(layer = 0; layer < self->nrOfLayers; layer++)
for(INT layer = 0; layer < self->nrOfLayers; layer++)
{
err = transportDec_ReadAccessUnit(self->hInput, layer);
if (err != TRANSPORTDEC_OK) {