diff --git a/lib_com/options.h b/lib_com/options.h index 79b51a0572ba05320040640b300360a88cd4ca83..a29cd30fdebe31badf824346c73e303438c86044 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -75,6 +75,7 @@ /*#define DISABLE_LIMITER*/ /* ################### Start MAINTENANCE switches ########################### */ +#define FIX_2255_ISAR_RENDER_POSES /* VA: issue 2255: fix missing check in isar_render_poses() */ /* ################### Start BE switches ################################# */ /* only BE switches wrt wrt. TS 26.251 V3.0 */ diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index cd866186505c68f3359aa948d57ed23ad9b4c4db..02de64d03d794d8f1e629844bd1bb53851a5a1ac 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -1208,8 +1208,18 @@ static ivas_error isar_render_poses( /* hIvasDec->flushbuffer = (void *) malloc( sizeof( Word16 ) * numPoses * BINAURAL_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES ); */ /* set16_fx( (Word16 *) hIvasDec->flushbuffer, 0, numPoses * BINAURAL_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES ); */ Word16 num_samples_flushbuffer; +#ifdef FIX_2255_ISAR_RENDER_POSES + num_samples_flushbuffer = mult0( shl( numPoses, 1 ) /* shl() == numPoses * BINAURAL_CHANNELS */, div_l( hIvasDec->nSamplesFrame, IVAS_MAX_PARAM_SPATIAL_SUBFRAMES ) ); +#else num_samples_flushbuffer = mult0( mult0( numPoses, BINAURAL_CHANNELS ), shl( div_l( hIvasDec->nSamplesFrame, IVAS_MAX_PARAM_SPATIAL_SUBFRAMES ), 1 ) ); +#endif hIvasDec->flushbuffer = (void *) malloc( L_mult0( sizeof( Word16 ), num_samples_flushbuffer ) ); +#ifdef FIX_2255_ISAR_RENDER_POSES + if ( hIvasDec->flushbuffer == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate flush buffer" ); + } +#endif set16_fx( (Word16 *) hIvasDec->flushbuffer, 0, num_samples_flushbuffer ); }