diff mbox

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

Message ID 20170703094902.15630-1-onemda@gmail.com
State Accepted
Commit cbbd330abc95d31ec3e67c6811333db015f54c01
Headers show

Commit Message

Paul B Mahol July 3, 2017, 9:49 a.m. UTC
Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
 libavcodec/alsdec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Thilo Borgmann July 3, 2017, 4:02 p.m. UTC | #1
Am 03.07.17 um 11:49 schrieb Paul B Mahol:
> Signed-off-by: Paul B Mahol <onemda@gmail.com>
> ---
>  libavcodec/alsdec.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Ok if you really feel we are anywhere near a sign bit here.

-Thilo
diff mbox

Patch

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);
                     }
                 }