[FFmpeg-devel] [PATCH] avcodec/alsdec: fix some undefined shifts

Paul B Mahol onemda at gmail.com
Mon Jul 3 12:49:02 EEST 2017


Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
 libavcodec/alsdec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index 37d6b38..df5e2bb 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -756,7 +756,7 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
             }
 
             for (k = 2; k < opt_order; k++)
-                quant_cof[k] = (quant_cof[k] << 14) + (add_base << 13);
+                quant_cof[k] = (quant_cof[k] * (1 << 14)) + (add_base << 13);
         }
     }
 
@@ -861,7 +861,7 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
                     res >>= 1;
 
                     if (cur_k) {
-                        res <<= cur_k;
+                        res  *= 1 << cur_k;
                         res  |= get_bits_long(gb, cur_k);
                     }
                 }
-- 
2.9.3



More information about the ffmpeg-devel mailing list