From 05091bc5e572bb6b93e51b11a3cff8a9146f1f38 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 13 Feb 2025 10:35:22 +0100 Subject: [PATCH] issue 1279: Avoid possible overflow of counter st->Nb_ACELP_frames; under NONBE_1279_COUNTER_OVERFLOW --- lib_com/options.h | 2 +- lib_enc/acelp_core_enc.c | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 7e2678dda5..0f1889ab8a 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -170,7 +170,7 @@ #define NONBE_FIX_GSC_BSTR /* VA: issue 1264: Fix bitstream synchronization between encoder and decoder in ACELP GSC in OMASA */ #define NONBE_1273_ISM_METADATA_COUNTER /* VA: issue 1273: fix counter overflow in ISM metadata encoder */ - +#define NONBE_1279_COUNTER_OVERFLOW /* VA: issue 1279: Avoid possible overflow of counter st->Nb_ACELP_frames */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_enc/acelp_core_enc.c b/lib_enc/acelp_core_enc.c index b12783d1c8..45d633cfc9 100644 --- a/lib_enc/acelp_core_enc.c +++ b/lib_enc/acelp_core_enc.c @@ -167,7 +167,14 @@ ivas_error acelp_core_enc( { st->Nb_ACELP_frames = 0; } +#ifdef NONBE_1279_COUNTER_OVERFLOW + if ( st->Nb_ACELP_frames < MAX16B ) + { + st->Nb_ACELP_frames++; + } +#else st->Nb_ACELP_frames++; +#endif if ( st->L_frame == L_FRAME ) { -- GitLab