diff --git a/lib_com/options.h b/lib_com/options.h index 24a8afca14acff7c80e0f2a98a2ea14233436f12..dfd3617e5b23e29f59acb90730ee3933166f1b02 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -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 ################################## */ diff --git a/lib_rend/ivas_vbap_fx.c b/lib_rend/ivas_vbap_fx.c index fdbd4f530274a9f4e83feb05b871101bead1ba76..2194e77754e7567f04bdf371bad40e5cda4834a0 100644 --- a/lib_rend/ivas_vbap_fx.c +++ b/lib_rend/ivas_vbap_fx.c @@ -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" ) ); } @@ -373,7 +381,14 @@ ivas_error vbap_init_data_fx( { vbap->num_search_structs = 2; move16(); +#ifdef FIX_BASOP_2288_VBAP_MALLOC + num_triplets = s_max( 0, ( speaker_nodes_group2_internal - 2 ) * 2 - s_max( 0, speaker_nodes_horiz_internal - 2 ) ); + move16(); + + IF( ( vbap->search_struct[1].triplets = (VBAP_VS_TRIPLET *) malloc( num_triplets * sizeof( VBAP_VS_TRIPLET ) ) ) == NULL ) +#else IF( ( vbap->search_struct[1].triplets = (VBAP_VS_TRIPLET *) malloc( ( ( speaker_nodes_group2_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" ) ); }