Commit 611eec13 authored by bayers's avatar bayers
Browse files

fix for #519, make sure to not access an not yet initialized transport channel buffer handle

parent 08305d0c
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -227,6 +227,7 @@
#define FIX_170_DTX_MASA                                /* Nokia: Fix issue 170, relaxing the use of DTX in MASA format */
#define FIX_510                                         /* FhG: fix issue 510, misleading error message for invalid input format */
#define FIX_509                                         /* FhG: fix issue 509, too low number of bitsream indices in SBA */
#define FIX_519_JBM_ACCESS_NULL_TC_BUFFER               /* FhG: fix issue 519, accessing a yet uninitialized TC Buffer in frame 0*/

/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
+13 −2
Original line number Diff line number Diff line
@@ -1084,8 +1084,15 @@ ivas_error IVAS_DEC_GetBufferedNumberOfSamples(
    {
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
    }

#ifdef FIX_519_JBM_ACCESS_NULL_TC_BUFFER
    /* check if the TC buffer already exists, otherweise nothing is buffered anyway */
    if ( hIvasDec->st_ivas->hTcBuffer != NULL )
    {
#endif
        *nSamplesBuffered = hIvasDec->st_ivas->hTcBuffer->n_samples_buffered - hIvasDec->st_ivas->hTcBuffer->n_samples_rendered;
#ifdef FIX_519_JBM_ACCESS_NULL_TC_BUFFER
    }
#endif

    return error;
}
@@ -1945,7 +1952,11 @@ ivas_error IVAS_DEC_VoIP_GetSamples(
            {
                int16_t nSamplesBuffered;
                nSamplesBuffered = 0;
#ifdef FIX_519_JBM_ACCESS_NULL_TC_BUFFER
                if ( hIvasDec->hasDecodedFirstGoodFrame )
#else
                if ( hIvasDec->hasBeenFedFirstGoodFrame )
#endif
                {
                    IVAS_DEC_GetBufferedNumberOfSamples( hIvasDec, &nSamplesBuffered );
                }