Commit 56984157 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

FIX_BASOP_2288_VBAP_MALLOC: fix malloc computation for VBAP triplets

parent 15135e63
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -91,6 +91,7 @@
#define FIX_2254_IMPROV_COMPLEXITY_BE                   /* VA: BE small complexity reduction  */
#define FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH /* FhG: fix oob indexing USAN complaint */
#define FIX_2287_MCT_MDCT_STEREO_DATA_MALLOC_SIZE       /* FhG: correct allocation size for STEREO_MDCT_DEC_DATA struct */
#define FIX_BASOP_2288_VBAP_MALLOC                      /* FhG/Nok: fix allocation size warning for VBAP triplets */

/* #################### End BE switches ################################## */

+8 −0
Original line number Diff line number Diff line
@@ -363,7 +363,15 @@ ivas_error vbap_init_data_fx(
            }
        }

#ifdef FIX_BASOP_2288_VBAP_MALLOC
        Word16 num_triplets = 0;
        num_triplets = s_max( 0, ( ( speaker_nodes_group1_internal - 2 ) * 2 - ( s_max( 0, ( speaker_nodes_horiz_internal - 2 ) ) ) ) );
        move16();

        IF( ( vbap->search_struct[0].triplets = (VBAP_VS_TRIPLET *) malloc( num_triplets * sizeof( VBAP_VS_TRIPLET ) ) ) == NULL )
#else
        IF( ( vbap->search_struct[0].triplets = (VBAP_VS_TRIPLET *) malloc( ( ( speaker_nodes_group1_internal - 2 ) * 2 - ( s_max( 0, ( speaker_nodes_horiz_internal - 2 ) ) ) ) * sizeof( VBAP_VS_TRIPLET ) ) ) == NULL )
#endif
        {
            return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for VBAP data\n" ) );
        }