]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/flacdec: Avoid undefined shift in error case
authorMichael Niedermayer <michael@niedermayer.cc>
Mon, 8 Mar 2021 23:55:38 +0000 (00:55 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 13 Mar 2021 20:02:31 +0000 (21:02 +0100)
Fixes: flac_1040988
Reported-by: Thomas Guilbert <tguilbert@google.com>
Reviewed-by: Thomas Guilbert <tguilbert@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/flacdec.c

index cf6128f897659427e6e73574e4c6e15b4928ae11..9e55bc136181094c3f153dd12025423cd1416ebe 100644 (file)
@@ -262,7 +262,7 @@ static int decode_residuals(FLACContext *s, int32_t *decoded, int pred_order)
         } else {
             int real_limit = tmp ? (INT_MAX >> tmp) + 2 : INT_MAX;
             for (; i < samples; i++) {
-                int v = get_sr_golomb_flac(&gb, tmp, real_limit, 0);
+                int v = get_sr_golomb_flac(&gb, tmp, real_limit, 1);
                 if (v == 0x80000000){
                     av_log(s->avctx, AV_LOG_ERROR, "invalid residual\n");
                     return AVERROR_INVALIDDATA;