Skip to content

Commit

Permalink
G722: Fix buffer overflow (BelledonneCommunications#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Schlager committed May 17, 2022
1 parent e2b8af6 commit 8559499
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/audiofilters/msg722.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ static void dec_process(MSFilter *f) {
/* introduce delay (TRANSITION_DELAY ms) */
generic_plc_update_continuity_buffer(s->plc_context, om->b_wptr, declen*sizeof(int16_t));

if (s->plc_context->plc_samples_used!=0) {
if (s->plc_context->plc_samples_used!=0 && declen >= 2*16*TRANSITION_DELAY) {
/* we were doing PLC, now resuming with normal audio, continuity buffer is twice the transition delay lengths,
* the second half is untouched by the update function and contains transition data generated by PLC */
generic_plc_transition_mix(((int16_t *)(om->b_wptr))+16*TRANSITION_DELAY, ((int16_t *)(s->plc_context->continuity_buffer))+16*TRANSITION_DELAY, 16*TRANSITION_DELAY);
Expand Down

0 comments on commit 8559499

Please sign in to comment.