[FFmpeg-cvslog] avcodec/ra144enc: Fix invalid left shift of negative number

Andreas Rheinhardt git at videolan.org
Fri Jul 3 03:10:41 EEST 2020


ffmpeg | branch: release/3.4 | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Wed Jan 22 15:52:10 2020 +0100| [4374da638ec944b485ece1ecb15fd9f562cde1cb] | committer: Andreas Rheinhardt

avcodec/ra144enc: Fix invalid left shift of negative number

by replacing it with a multiplication. Said multiplication can't
overflow an int32_t because lpc_coefs is limited to 16 bit precision.

Fixes the FACE-test acodec-ra144 as well as part of #8217.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit e3fb9af6f1353f30855eaa1cbd5befaf06e303b8)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4374da638ec944b485ece1ecb15fd9f562cde1cb
---

 libavcodec/ra144enc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/ra144enc.c b/libavcodec/ra144enc.c
index cc4f381606..059f582334 100644
--- a/libavcodec/ra144enc.c
+++ b/libavcodec/ra144enc.c
@@ -477,8 +477,8 @@ static int ra144_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
                       LPC_ORDER, 16, lpc_coefs, shift, FF_LPC_TYPE_LEVINSON,
                       0, ORDER_METHOD_EST, 0, 12, 0);
     for (i = 0; i < LPC_ORDER; i++)
-        block_coefs[NBLOCKS - 1][i] = -(lpc_coefs[LPC_ORDER - 1][i] <<
-                                        (12 - shift[LPC_ORDER - 1]));
+        block_coefs[NBLOCKS - 1][i] = -lpc_coefs[LPC_ORDER - 1][i]
+                                       * (1 << (12 - shift[LPC_ORDER - 1]));
 
     /**
      * TODO: apply perceptual weighting of the input speech through bandwidth



More information about the ffmpeg-cvslog mailing list