You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
avcodec/wavarc: Check that nb_samples is not negative
It is currently probably not possible for it to be negative as the needed 2Mb input buf size is not achievable. But it is more robust to check for it too. If it would become negative than code like s->samples[0][n] = s->samples[0][s->nb_samples + n]; would crash Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
@@ -311,7 +311,7 @@ static int decode_2slp(AVCodecContext *avctx,
|
||||
return AVERROR_EOF;
|
||||
case 8:
|
||||
s->nb_samples = get_urice(gb, 8);
|
||||
if (s->nb_samples > 570) {
|
||||
if (s->nb_samples > 570U) {
|
||||
s->nb_samples = 570;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
@@ -587,7 +587,7 @@ static int decode_5elp(AVCodecContext *avctx,
|
||||
return AVERROR_EOF;
|
||||
case 11:
|
||||
s->nb_samples = get_urice(gb, 8);
|
||||
if (s->nb_samples > 570) {
|
||||
if (s->nb_samples > 570U) {
|
||||
s->nb_samples = 570;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
Reference in New Issue
Block a user