From 648e74fd39eef0c92f958605ab648ad58bc1025c Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Fri, 5 Feb 2021 18:38:25 +0100 Subject: [PATCH] TT#108003 Handle unsigned wrap around in amr_encoder_mode_change() We only do 1 decrements/increments so the check for the upper-bound will always catch any downward wrap-around or an upward out-of-bound. Change-Id: Ibdb9a69e1a55f34ffca56721c310efc505b86f99 Warned-by: coverity --- lib/codeclib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/codeclib.c b/lib/codeclib.c index e5c684f40..230e526ac 100644 --- a/lib/codeclib.c +++ b/lib/codeclib.c @@ -2017,7 +2017,7 @@ static void amr_encoder_mode_change(encoder_t *enc) { // step up or down towards the current bitrate cmr += cmr_diff; // still in bounds? - if (cmr < 0 || cmr >= AMR_FT_TYPES) + if (cmr >= AMR_FT_TYPES) break; cmr_br = enc->codec_options.amr.bitrates[cmr]; if (cmr_br == cur_br)