From 36b82ad194120e7b9aaa5288ea5ccb050be51c21 Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin Date: Fri, 5 Jul 2024 13:20:42 -0400 Subject: [PATCH] Fix undefined left shift of negative value --- celt/rate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/celt/rate.c b/celt/rate.c index 7f7ad3fa0..58a61f7ba 100644 --- a/celt/rate.c +++ b/celt/rate.c @@ -189,7 +189,7 @@ void compute_pulse_cache(CELTMode *m, int LM) /* Offset the number of qtheta bits by log2(N)/2 + QTHETA_OFFSET compared to their "fair share" of total/N */ - offset = ((m->logN[j]+((LM0+k)<>1)-QTHETA_OFFSET; + offset = ((m->logN[j]+(opus_int32)((opus_uint32)(LM0+k)<>1)-QTHETA_OFFSET; /* The number of qtheta bits we'll allocate if the remainder is to be max_bits. The average measured cost for theta is 0.89701 times qb,