[FFmpeg-cvslog] avcodec/dcaenc: Fix undefined left shift of negative numbers

Andreas Rheinhardt git at videolan.org
Sat Apr 3 01:18:24 EEST 2021


ffmpeg | branch: release/4.4 | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Fri Mar 26 06:03:49 2021 +0100| [a8fb9c9d2740c54adb5192f02207a32a66f29618] | committer: Andreas Rheinhardt

avcodec/dcaenc: Fix undefined left shift of negative numbers

Affected the acodec-dca and acodec-dca2 FATE tests.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
(cherry picked from commit 659a925939011338cac1ab3c21d58d4b077fc926)

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

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

diff --git a/libavcodec/dcaenc.c b/libavcodec/dcaenc.c
index a40d2e0ca0..87fb5f5457 100644
--- a/libavcodec/dcaenc.c
+++ b/libavcodec/dcaenc.c
@@ -925,10 +925,10 @@ static void fill_in_adpcm_bufer(DCAEncContext *c)
              * But there are no proper value in decoder history, so likely result will be no good.
              * Bitstream has "Predictor history flag switch", but this flag disables history for all subbands
              */
-            samples[0] = c->adpcm_history[ch][band][0] << 7;
-            samples[1] = c->adpcm_history[ch][band][1] << 7;
-            samples[2] = c->adpcm_history[ch][band][2] << 7;
-            samples[3] = c->adpcm_history[ch][band][3] << 7;
+            samples[0] = c->adpcm_history[ch][band][0] * (1 << 7);
+            samples[1] = c->adpcm_history[ch][band][1] * (1 << 7);
+            samples[2] = c->adpcm_history[ch][band][2] * (1 << 7);
+            samples[3] = c->adpcm_history[ch][band][3] * (1 << 7);
         }
      }
 }



More information about the ffmpeg-cvslog mailing list