mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-28 12:32:17 +02:00
avcodec/aacdec_template (fixed point): Check gain in decode_cce() to avoid undefined shifts later
Fixes: runtime error: shift exponent 47 is too large for 32-bit type 'int' Fixes: 2581/clusterfuzz-testcase-minimized-4681474395602944 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
79450adfc8
commit
2886142e0c
@ -2199,6 +2199,10 @@ static int decode_cce(AACContext *ac, GetBitContext *gb, ChannelElement *che)
|
|||||||
cge = coup->coupling_point == AFTER_IMDCT ? 1 : get_bits1(gb);
|
cge = coup->coupling_point == AFTER_IMDCT ? 1 : get_bits1(gb);
|
||||||
gain = cge ? get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60: 0;
|
gain = cge ? get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60: 0;
|
||||||
gain_cache = GET_GAIN(scale, gain);
|
gain_cache = GET_GAIN(scale, gain);
|
||||||
|
#if USE_FIXED
|
||||||
|
if ((abs(gain_cache)-1024) >> 3 > 30)
|
||||||
|
return AVERROR(ERANGE);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if (coup->coupling_point == AFTER_IMDCT) {
|
if (coup->coupling_point == AFTER_IMDCT) {
|
||||||
coup->gain[c][0] = gain_cache;
|
coup->gain[c][0] = gain_cache;
|
||||||
@ -2216,6 +2220,10 @@ static int decode_cce(AACContext *ac, GetBitContext *gb, ChannelElement *che)
|
|||||||
t >>= 1;
|
t >>= 1;
|
||||||
}
|
}
|
||||||
gain_cache = GET_GAIN(scale, t) * s;
|
gain_cache = GET_GAIN(scale, t) * s;
|
||||||
|
#if USE_FIXED
|
||||||
|
if ((abs(gain_cache)-1024) >> 3 > 30)
|
||||||
|
return AVERROR(ERANGE);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
coup->gain[c][idx] = gain_cache;
|
coup->gain[c][idx] = gain_cache;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user