1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec/flacdec: Avoid undefined shift in error case

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>
This commit is contained in:
Michael Niedermayer 2021-03-09 00:55:38 +01:00
parent 09b3040354
commit bd525e2876

View File

@ -262,7 +262,7 @@ static int decode_residuals(FLACContext *s, int32_t *decoded, int pred_order)
} else { } else {
int real_limit = tmp ? (INT_MAX >> tmp) + 2 : INT_MAX; int real_limit = tmp ? (INT_MAX >> tmp) + 2 : INT_MAX;
for (; i < samples; i++) { 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){ if (v == 0x80000000){
av_log(s->avctx, AV_LOG_ERROR, "invalid residual\n"); av_log(s->avctx, AV_LOG_ERROR, "invalid residual\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;