aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Android.bp3
-rw-r--r--ChangeLog4
-rw-r--r--Makefile.am3
-rw-r--r--OWNERS2
-rw-r--r--configure.ac4
-rw-r--r--libAACdec/src/block.cpp2
-rw-r--r--libAACenc/src/aacenc_tns.cpp5
-rw-r--r--libAACenc/src/adj_thr.cpp2
-rw-r--r--libAACenc/src/sf_estim.cpp1
-rw-r--r--libFDK/include/FDK_bitstream.h10
-rw-r--r--libMpegTPDec/src/tpdec_adts.cpp3
-rw-r--r--libMpegTPDec/src/tpdec_asc.cpp12
-rw-r--r--libMpegTPDec/src/tpdec_lib.cpp2
-rw-r--r--libSBRdec/src/psdec.cpp22
-rw-r--r--libSBRdec/src/sbrdecoder.cpp7
15 files changed, 65 insertions, 17 deletions
diff --git a/Android.bp b/Android.bp
index 75fe8af..13f87c8 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,5 +1,6 @@
cc_library_static {
name: "libFraunhoferAAC",
+ vendor_available: true,
srcs: [
"libAACdec/src/*.cpp",
"libAACenc/src/*.cpp",
@@ -12,6 +13,8 @@ cc_library_static {
"libSBRenc/src/*.cpp",
],
cflags: [
+ "-Werror",
+ "-Wno-constant-conversion",
"-Wno-sequence-point",
"-Wno-extra",
"-Wno-#warnings",
diff --git a/ChangeLog b/ChangeLog
index b544ece..a36902f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+0.1.6
+ - Lots of minor assorted crash/fuzz fixes, mostly for the decoder but
+ also some for the encoder
+
0.1.5
- Updated upstream sources
- Fixed building with GCC 3.3 and 3.4
diff --git a/Makefile.am b/Makefile.am
index 11fbef1..9ead8f1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -189,7 +189,8 @@ EXTRA_DIST = \
$(top_srcdir)/autogen.sh \
$(top_srcdir)/MODULE_LICENSE_FRAUNHOFER \
$(top_srcdir)/NOTICE \
- $(top_srcdir)/Android.mk \
+ $(top_srcdir)/OWNERS \
+ $(top_srcdir)/Android.bp \
$(top_srcdir)/fdk-aac.sym \
$(top_srcdir)/Makefile.vc \
$(top_srcdir)/documentation/*.pdf \
diff --git a/OWNERS b/OWNERS
new file mode 100644
index 0000000..ffd753e
--- /dev/null
+++ b/OWNERS
@@ -0,0 +1,2 @@
+jmtrivi@google.com
+gkasten@android.com
diff --git a/configure.ac b/configure.ac
index 1485ff7..86a9102 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
dnl -*- Autoconf -*-
dnl Process this file with autoconf to produce a configure script.
-AC_INIT([fdk-aac], [0.1.5], [http://sourceforge.net/projects/opencore-amr/])
+AC_INIT([fdk-aac], [0.1.6], [http://sourceforge.net/projects/opencore-amr/])
AC_CONFIG_AUX_DIR(.)
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([tar-ustar foreign])
@@ -26,7 +26,7 @@ AC_SEARCH_LIBS([sin], [m])
dnl soname version to use
dnl goes by ‘current[:revision[:age]]’ with the soname ending up as
dnl current.age.revision
-FDK_AAC_VERSION=1:0:0
+FDK_AAC_VERSION=1:1:0
AS_IF([test x$enable_shared = xyes], [LIBS_PRIVATE=$LIBS], [LIBS_PUBLIC=$LIBS])
AC_SUBST(FDK_AAC_VERSION)
diff --git a/libAACdec/src/block.cpp b/libAACdec/src/block.cpp
index bda565c..8bee2d4 100644
--- a/libAACdec/src/block.cpp
+++ b/libAACdec/src/block.cpp
@@ -138,7 +138,7 @@ LONG CBlock_GetEscape(HANDLE_FDK_BITSTREAM bs, /*!< pointer to bitstream */
if (i > 16)
{
- if (i - 16 > CACHE_BITS) { /* cannot read more than "CACHE_BITS" bits at once in the function FDKreadBits() */
+ if (i >= 31) { /* (1 << i) will shift into the sign bit if i >= 31 */
return (MAX_QUANTIZED_VALUE + 1); /* returning invalid value that will be captured later */
}
diff --git a/libAACenc/src/aacenc_tns.cpp b/libAACenc/src/aacenc_tns.cpp
index d0ff6ac..f036518 100644
--- a/libAACenc/src/aacenc_tns.cpp
+++ b/libAACenc/src/aacenc_tns.cpp
@@ -409,7 +409,7 @@ AAC_ENCODER_ERROR FDKaacEnc_InitTnsConfiguration(INT bitRate,
case 960:
case 1024:
/* TNS start line: skip lower MDCT lines to prevent artifacts due to filter mismatch */
- tC->lpcStartBand[LOFILT] = (blockType == SHORT_WINDOW) ? 0 : ((sampleRate < 18783) ? 4 : 8);
+ tC->lpcStartBand[LOFILT] = (blockType == SHORT_WINDOW) ? 0 : ((sampleRate <= 8000) ? 2 : ((sampleRate < 18783) ? 4 : 8));
tC->lpcStartLine[LOFILT] = pC->sfbOffset[tC->lpcStartBand[LOFILT]];
i = tC->lpcStopBand;
@@ -1168,6 +1168,9 @@ static INT FDKaacEnc_AutoToParcor(
workBuffer++;
}
+ if (input[0] == 0)
+ input[0] = 1;
+
tmp = fMult((FIXP_DBL)((LONG)TNS_PREDGAIN_SCALE<<21), fDivNorm(fAbs(autoCorr_0), fAbs(input[0]), &scale));
if ( fMultDiv2(autoCorr_0, input[0])<FL2FXCONST_DBL(0.0f) ) {
tmp = -tmp;
diff --git a/libAACenc/src/adj_thr.cpp b/libAACenc/src/adj_thr.cpp
index a79a9ae..09584f4 100644
--- a/libAACenc/src/adj_thr.cpp
+++ b/libAACenc/src/adj_thr.cpp
@@ -958,7 +958,7 @@ static FIXP_DBL FDKaacEnc_calcChaosMeasure(PSY_OUT_CHANNEL *psyOutChannel,
CalcInvLdData( (((CalcLdData(frameFormFactor)>>1) -
(CalcLdData(frameEnergy)>>(2+1))) -
(fMultDiv2(FL2FXCONST_DBL(0.75f),CalcLdData((FIXP_DBL)frameNLines<<(DFRACT_BITS-1-SCALE_NLINES))) -
- (((FIXP_DBL)(SCALE_FORM_FAC-SCALE_NRGS_SQRT4+FORM_FAC_SHIFT-(SCALE_NLINES_P34))<<(DFRACT_BITS-1-LD_DATA_SHIFT))>>1))
+ (((FIXP_DBL)(-((-SCALE_FORM_FAC+SCALE_NRGS_SQRT4-FORM_FAC_SHIFT+SCALE_NLINES_P34) << (DFRACT_BITS-1-LD_DATA_SHIFT))))>>1))
)<<1 );
} else {
diff --git a/libAACenc/src/sf_estim.cpp b/libAACenc/src/sf_estim.cpp
index 1cb243b..75b8d42 100644
--- a/libAACenc/src/sf_estim.cpp
+++ b/libAACenc/src/sf_estim.cpp
@@ -533,6 +533,7 @@ static void FDKaacEnc_assimilateSingleScf(PSY_OUT_CHANNEL *psyOutChan,
(scfAct > scfMin) &&
(scfAct <= scfMin+MAX_SCF_DELTA) &&
(scfAct >= scfMax-MAX_SCF_DELTA) &&
+ (scfAct <= fixMin(scfMin,fixMin(*scfLast, *scfNext))+MAX_SCF_DELTA) &&
(*scfLast != prevScfLast[sfbAct] ||
*scfNext != prevScfNext[sfbAct] ||
deltaPe < deltaPeLast[sfbAct])) {
diff --git a/libFDK/include/FDK_bitstream.h b/libFDK/include/FDK_bitstream.h
index d47a750..e75e570 100644
--- a/libFDK/include/FDK_bitstream.h
+++ b/libFDK/include/FDK_bitstream.h
@@ -245,7 +245,7 @@ FDK_INLINE UINT FDKreadBits(HANDLE_FDK_BITSTREAM hBitStream,
if (hBitStream->BitsInCache <= numberOfBits)
{
- const UINT validBits = FDK_getValidBits (&hBitStream->hBitBuf) ;
+ const INT validBits = FDK_getValidBits (&hBitStream->hBitBuf) ;
const INT freeBits = (CACHE_BITS-1) - hBitStream->BitsInCache ;
const INT bitsToRead = (freeBits <= validBits) ? freeBits : validBits ;
@@ -277,11 +277,15 @@ FDK_INLINE UINT FDKreadBit(HANDLE_FDK_BITSTREAM hBitStream)
hBitStream->CacheWord = FDK_get32 (&hBitStream->hBitBuf);
hBitStream->BitsInCache = CACHE_BITS;
}
- else
+ else if (validBits > 0)
{
hBitStream->CacheWord = FDK_get (&hBitStream->hBitBuf,validBits);
hBitStream->BitsInCache = validBits;
}
+ else
+ {
+ return 0;
+ }
}
hBitStream->BitsInCache--;
@@ -305,7 +309,7 @@ inline UINT FDKread2Bits(HANDLE_FDK_BITSTREAM hBitStream)
UINT BitsInCache = hBitStream->BitsInCache;
if (BitsInCache < 2) /* Comparison changed from 'less-equal' to 'less' */
{
- const UINT validBits = FDK_getValidBits (&hBitStream->hBitBuf) ;
+ const INT validBits = FDK_getValidBits (&hBitStream->hBitBuf) ;
const INT freeBits = (CACHE_BITS-1) - BitsInCache ;
const INT bitsToRead = (freeBits <= validBits) ? freeBits : validBits ;
diff --git a/libMpegTPDec/src/tpdec_adts.cpp b/libMpegTPDec/src/tpdec_adts.cpp
index c455681..934fbc8 100644
--- a/libMpegTPDec/src/tpdec_adts.cpp
+++ b/libMpegTPDec/src/tpdec_adts.cpp
@@ -185,6 +185,9 @@ TRANSPORTDEC_ERROR adtsRead_DecodeHeader(
#endif
valBits = FDKgetValidBits(hBs);
+ if (valBits < ADTS_HEADERLENGTH) {
+ return TRANSPORTDEC_NOT_ENOUGH_BITS;
+ }
/* adts_fixed_header */
bs.mpeg_id = FDKreadBits(hBs, Adts_Length_Id);
diff --git a/libMpegTPDec/src/tpdec_asc.cpp b/libMpegTPDec/src/tpdec_asc.cpp
index 96a1b35..a292bcb 100644
--- a/libMpegTPDec/src/tpdec_asc.cpp
+++ b/libMpegTPDec/src/tpdec_asc.cpp
@@ -650,6 +650,8 @@ int CProgramConfig_LookupElement(
/* search in front channels */
for (i = 0; i < pPce->NumFrontChannelElements; i++) {
int heightLayer = pPce->FrontElementHeightInfo[i];
+ if (heightLayer >= PC_NUM_HEIGHT_LAYER)
+ return 0;
if (isCpe == pPce->FrontElementIsCpe[i] && pPce->FrontElementTagSelect[i] == tag) {
int h, elIdx = ec[heightLayer], chIdx = cc[heightLayer];
AUDIO_CHANNEL_TYPE aChType = (AUDIO_CHANNEL_TYPE)((heightLayer<<4) | ACT_FRONT);
@@ -704,6 +706,8 @@ int CProgramConfig_LookupElement(
/* search in side channels */
for (i = 0; i < pPce->NumSideChannelElements; i++) {
int heightLayer = pPce->SideElementHeightInfo[i];
+ if (heightLayer >= PC_NUM_HEIGHT_LAYER)
+ return 0;
if (isCpe == pPce->SideElementIsCpe[i] && pPce->SideElementTagSelect[i] == tag) {
int h, elIdx = ec[heightLayer], chIdx = cc[heightLayer];
AUDIO_CHANNEL_TYPE aChType = (AUDIO_CHANNEL_TYPE)((heightLayer<<4) | ACT_SIDE);
@@ -758,6 +762,8 @@ int CProgramConfig_LookupElement(
/* search in back channels */
for (i = 0; i < pPce->NumBackChannelElements; i++) {
int heightLayer = pPce->BackElementHeightInfo[i];
+ if (heightLayer >= PC_NUM_HEIGHT_LAYER)
+ return 0;
if (isCpe == pPce->BackElementIsCpe[i] && pPce->BackElementTagSelect[i] == tag) {
int h, elIdx = ec[heightLayer], chIdx = cc[heightLayer];
AUDIO_CHANNEL_TYPE aChType = (AUDIO_CHANNEL_TYPE)((heightLayer<<4) | ACT_BACK);
@@ -817,18 +823,24 @@ int CProgramConfig_LookupElement(
Start with counting the front channels/elements at normal height */
for (i = 0; i < pPce->NumFrontChannelElements; i+=1) {
int heightLayer = pPce->FrontElementHeightInfo[i];
+ if (heightLayer >= PC_NUM_HEIGHT_LAYER)
+ return 0;
ec[heightLayer] += 1;
cc[heightLayer] += (pPce->FrontElementIsCpe[i]) ? 2 : 1;
}
/* Count side channels/elements at normal height */
for (i = 0; i < pPce->NumSideChannelElements; i+=1) {
int heightLayer = pPce->SideElementHeightInfo[i];
+ if (heightLayer >= PC_NUM_HEIGHT_LAYER)
+ return 0;
ec[heightLayer] += 1;
cc[heightLayer] += (pPce->SideElementIsCpe[i]) ? 2 : 1;
}
/* Count back channels/elements at normal height */
for (i = 0; i < pPce->NumBackChannelElements; i+=1) {
int heightLayer = pPce->BackElementHeightInfo[i];
+ if (heightLayer >= PC_NUM_HEIGHT_LAYER)
+ return 0;
ec[heightLayer] += 1;
cc[heightLayer] += (pPce->BackElementIsCpe[i]) ? 2 : 1;
}
diff --git a/libMpegTPDec/src/tpdec_lib.cpp b/libMpegTPDec/src/tpdec_lib.cpp
index 24f755b..5760752 100644
--- a/libMpegTPDec/src/tpdec_lib.cpp
+++ b/libMpegTPDec/src/tpdec_lib.cpp
@@ -342,7 +342,7 @@ TRANSPORTDEC_ERROR transportDec_FillData(
}
} else {
/* ... else feed bitbuffer with new stream data (append). */
- if (hTp->numberOfRawDataBlocks <= 0) {
+ if ((hTp->numberOfRawDataBlocks <= 0) || (FDKgetValidBits(hBs)==0)) {
FDKfeedBuffer (hBs, pBuffer, bufferSize, pBytesValid) ;
}
}
diff --git a/libSBRdec/src/psdec.cpp b/libSBRdec/src/psdec.cpp
index 965917a..1729f90 100644
--- a/libSBRdec/src/psdec.cpp
+++ b/libSBRdec/src/psdec.cpp
@@ -938,13 +938,13 @@ void initSlotBasedRotation( HANDLE_PS_DEC h_ps_d, /*!< pointer to the module sta
INT group = 0;
INT bin = 0;
- INT noIidSteps;
+ INT noIidSteps, noFactors;
/* const UCHAR *pQuantizedIIDs;*/
FIXP_SGL invL;
FIXP_DBL ScaleL, ScaleR;
- FIXP_DBL Alpha, Beta;
+ FIXP_DBL Alpha, Beta, AlphasValue;
FIXP_DBL h11r, h12r, h21r, h22r;
const FIXP_DBL *PScaleFactors;
@@ -984,6 +984,7 @@ void initSlotBasedRotation( HANDLE_PS_DEC h_ps_d, /*!< pointer to the module sta
{
PScaleFactors = ScaleFactorsFine; /* values are shiftet right by one */
noIidSteps = NO_IID_STEPS_FINE;
+ noFactors = NO_IID_LEVELS_FINE;
/*pQuantizedIIDs = quantizedIIDsFine;*/
}
@@ -991,6 +992,7 @@ void initSlotBasedRotation( HANDLE_PS_DEC h_ps_d, /*!< pointer to the module sta
{
PScaleFactors = ScaleFactors; /* values are shiftet right by one */
noIidSteps = NO_IID_STEPS;
+ noFactors = NO_IID_LEVELS;
/*pQuantizedIIDs = quantizedIIDs;*/
}
@@ -1012,11 +1014,17 @@ void initSlotBasedRotation( HANDLE_PS_DEC h_ps_d, /*!< pointer to the module sta
/* ScaleR and ScaleL are scaled by 1 shift right */
- ScaleR = PScaleFactors[noIidSteps + h_ps_d->specificTo.mpeg.coef.aaIidIndexMapped[env][bin]];
- ScaleL = PScaleFactors[noIidSteps - h_ps_d->specificTo.mpeg.coef.aaIidIndexMapped[env][bin]];
-
- Beta = fMult (fMult( Alphas[h_ps_d->specificTo.mpeg.coef.aaIccIndexMapped[env][bin]], ( ScaleR - ScaleL )), FIXP_SQRT05);
- Alpha = Alphas[h_ps_d->specificTo.mpeg.coef.aaIccIndexMapped[env][bin]]>>1;
+ ScaleL = ScaleR = 0;
+ if (noIidSteps + h_ps_d->specificTo.mpeg.coef.aaIidIndexMapped[env][bin] >= 0 && noIidSteps + h_ps_d->specificTo.mpeg.coef.aaIidIndexMapped[env][bin] < noFactors)
+ ScaleR = PScaleFactors[noIidSteps + h_ps_d->specificTo.mpeg.coef.aaIidIndexMapped[env][bin]];
+ if (noIidSteps - h_ps_d->specificTo.mpeg.coef.aaIidIndexMapped[env][bin] >= 0 && noIidSteps - h_ps_d->specificTo.mpeg.coef.aaIidIndexMapped[env][bin] < noFactors)
+ ScaleL = PScaleFactors[noIidSteps - h_ps_d->specificTo.mpeg.coef.aaIidIndexMapped[env][bin]];
+
+ AlphasValue = 0;
+ if (h_ps_d->specificTo.mpeg.coef.aaIccIndexMapped[env][bin] >= 0)
+ AlphasValue = Alphas[h_ps_d->specificTo.mpeg.coef.aaIccIndexMapped[env][bin]];
+ Beta = fMult (fMult( AlphasValue, ( ScaleR - ScaleL )), FIXP_SQRT05);
+ Alpha = AlphasValue>>1;
/* Alpha and Beta are now both scaled by 2 shifts right */
diff --git a/libSBRdec/src/sbrdecoder.cpp b/libSBRdec/src/sbrdecoder.cpp
index f9ded54..a341746 100644
--- a/libSBRdec/src/sbrdecoder.cpp
+++ b/libSBRdec/src/sbrdecoder.cpp
@@ -1444,6 +1444,13 @@ sbrDecoder_DecodeElement (
self->flags |= (applyPs) ? SBRDEC_PS_DECODED : 0;
}
+ if (channelMapping[0] == 255 || ((*numOutChannels == 2) && channelMapping[1] == 255))
+ return SBRDEC_UNSUPPORTED_CONFIG;
+ if (!pSbrChannel[0]->SbrDec.LppTrans.pSettings)
+ return SBRDEC_UNSUPPORTED_CONFIG;
+ if (stereo && !pSbrChannel[1]->SbrDec.LppTrans.pSettings)
+ return SBRDEC_UNSUPPORTED_CONFIG;
+
/* Set strides for reading and writing */
if (interleaved) {
strideIn = numInChannels;