Commit 6f966b7e authored by vaclav's avatar vaclav
Browse files

Merge branch...

Merge branch '1070-usan-nullptr-with-offset-and-segfaults-in-7_1_4-to-binaural-and-binaural_room_reverb-decoding-2' into 'main'

Resolve "USAN: nullptr-with-offset and Segfaults in 7_1_4 to BINAURAL and BINAURAL_ROOM_REVERB decoding with bitrate switching and head rotation"

See merge request !1606
parents 6f7935ac 8c77706c
Loading
Loading
Loading
Loading
Loading
+1 −17
Original line number Diff line number Diff line
@@ -2335,11 +2335,7 @@ ivas_error ivas_jbm_dec_tc_buffer_open(
    const int16_t n_samples_granularity     /* i  : granularity of the renderer/buffer  */
)
{
#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT
    int32_t nsamp_to_allocate;
#else
    int16_t nsamp_to_allocate;
#endif
    DECODER_TC_BUFFER_HANDLE hTcBuffer;
    int16_t nMaxSlotsPerSubframe;
    int16_t nchan_residual;
@@ -2414,15 +2410,12 @@ ivas_error ivas_jbm_dec_tc_buffer_open(
        {
            if ( st_ivas->hDecoderConfig->Opt_tsm )
            {
                /* note: the maximum buffer length is for OSBA DISC mode with ISMs -> 15*(1920+239)=32385 samples */
                if ( ( hTcBuffer->tc_buffer = (float *) malloc( nsamp_to_allocate * sizeof( float ) ) ) == NULL )
                {
                    return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM TC Buffer\n" ) );
                }
#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT
                set_zero_l( hTcBuffer->tc_buffer, nsamp_to_allocate );
#else
                set_zero( hTcBuffer->tc_buffer, nsamp_to_allocate );
#endif

                offset = 0;
                for ( ch_idx = 0; ch_idx < hTcBuffer->nchan_buffer_full; ch_idx++ )
@@ -2468,12 +2461,7 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure(
    const int16_t n_samples_granularity     /* i  : new granularity of the renderer/buffer  */
)
{
#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT
    int32_t nsamp_to_allocate, offset;
    int16_t n_samp_full, n_samp_residual, nchan_residual;
#else
    int16_t nsamp_to_allocate, n_samp_full, n_samp_residual, offset, nchan_residual;
#endif
    int16_t ch_idx;
    DECODER_TC_BUFFER_HANDLE hTcBuffer;

@@ -2560,11 +2548,7 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure(
            {
                return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM TC Buffer\n" ) );
            }
#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT
            set_zero_l( hTcBuffer->tc_buffer, nsamp_to_allocate );
#else
            set_zero( hTcBuffer->tc_buffer, nsamp_to_allocate );
#endif

            offset = 0;
            for ( ch_idx = 0; ch_idx < hTcBuffer->nchan_buffer_full; ch_idx++ )