Counter overflow in ivas_ism_metadata_enc_fx()
Basic info
- Fixed point:
- Encoder (fixed): 21cecc43
Bug description
Using the a very long file (basically any file longer than 32767 frames) cause an overflow in some counters in function ivas_ism_metadata_enc_fx()
the code is located after line 800:
FOR( ch = 0; ch < nchan_ism; ch++ )
{
hIsmMeta[ch]->last_ism_metadata_flag = hIsmMeta[ch]->ism_metadata_flag;
move16();
IF( hIsmMeta[ch]->ism_metadata_flag == 0 )
{
>>> hIsmMeta[ch]->ism_md_fec_cnt_enc = add( hIsmMeta[ch]->ism_md_fec_cnt_enc, 1 );
move16();
}
ELSE
{
hIsmMeta[ch]->ism_md_fec_cnt_enc = 0;
move16();
}
hIsmMeta[ch]->ism_md_inc_diff_cnt = add( hIsmMeta[ch]->ism_md_inc_diff_cnt, 1 );
move16();
hIsmMeta[ch]->ism_md_inc_diff_cnt = s_min( hIsmMeta[ch]->ism_md_inc_diff_cnt, ISM_MD_INC_DIFF_CNT_MAX );
move16();
}
cc @vasilache, @vaclav the same problem may be happening in float as well The datatype should be change or a limit should be added to ensure it doesn't overflow
Ways to reproduce
IVAS_cod -ISM 1 NULL 32000 16 longlongfile.wav bit