[FFmpeg-cvslog] avcodec/pcm: Fix undefined shifts

Andreas Rheinhardt git at videolan.org
Wed May 20 08:38:38 EEST 2020


ffmpeg | branch: release/4.2 | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Fri Sep 20 00:17:01 2019 +0200| [21cc3c0d877981cfc30fe936f04cd68863469cbc] | committer: Andreas Rheinhardt

avcodec/pcm: Fix undefined shifts

Fixes the acodec-pcm-u16[lb]e FATE-tests.

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

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

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

diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c
index 95dd86ac12..7178c988bd 100644
--- a/libavcodec/pcm.c
+++ b/libavcodec/pcm.c
@@ -306,7 +306,7 @@ static av_cold int pcm_decode_close(AVCodecContext *avctx)
 #define DECODE(size, endian, src, dst, n, shift, offset)                \
     for (; n > 0; n--) {                                                \
         uint ## size ## _t v = bytestream_get_ ## endian(&src);         \
-        AV_WN ## size ## A(dst, (v - offset) << shift);                 \
+        AV_WN ## size ## A(dst, (uint ## size ## _t)(v - offset) << shift); \
         dst += size / 8;                                                \
     }
 
@@ -317,7 +317,7 @@ static av_cold int pcm_decode_close(AVCodecContext *avctx)
         dst = frame->extended_data[c];                                \
         for (i = n; i > 0; i--) {                                       \
             uint ## size ## _t v = bytestream_get_ ## endian(&src);     \
-            AV_WN ## size ## A(dst, (v - offset) << shift);             \
+            AV_WN ## size ## A(dst, (uint ## size ##_t)(v - offset) << shift); \
             dst += size / 8;                                            \
         }                                                               \
     }



More information about the ffmpeg-cvslog mailing list