aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Aimar <fenrir@videolan.org>2011-09-27 22:15:31 +0000
committerReinhard Tartler <siretart@tauware.de>2012-03-18 17:50:31 +0100
commit905d0633a6e8f345bd6a0ae442d77cc03cf62c4b (patch)
tree375729684ee156a8b4d7dee6e14aa723ae94d84c
parent95605595b57e8fdfd9fdc591766b8286dd017ee4 (diff)
downloadffmpeg-905d0633a6e8f345bd6a0ae442d77cc03cf62c4b.tar.gz
wmavoice: Check for corrupted extra data
Signed-off-by: Janne Grunau <janne-libav@jannau.net> (cherry picked from commit d99427cb8ba099375d8cce6df808d4acf045ab43) Signed-off-by: Anton Khirnov <anton@khirnov.net>
-rw-r--r--libavcodec/wmavoice.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c
index 95376163a7..9588ecd807 100644
--- a/libavcodec/wmavoice.c
+++ b/libavcodec/wmavoice.c
@@ -401,6 +401,10 @@ static av_cold int wmavoice_decode_init(AVCodecContext *ctx)
s->min_pitch_val = ((ctx->sample_rate << 8) / 400 + 50) >> 8;
s->max_pitch_val = ((ctx->sample_rate << 8) * 37 / 2000 + 50) >> 8;
pitch_range = s->max_pitch_val - s->min_pitch_val;
+ if (pitch_range <= 0) {
+ av_log(ctx, AV_LOG_ERROR, "Invalid pitch range; broken extradata?\n");
+ return -1;
+ }
s->pitch_nbits = av_ceil_log2(pitch_range);
s->last_pitch_val = 40;
s->last_acb_type = ACB_TYPE_NONE;
@@ -422,6 +426,10 @@ static av_cold int wmavoice_decode_init(AVCodecContext *ctx)
s->block_conv_table[2] = (pitch_range * 44) >> 6;
s->block_conv_table[3] = s->max_pitch_val - 1;
s->block_delta_pitch_hrange = (pitch_range >> 3) & ~0xF;
+ if (s->block_delta_pitch_hrange <= 0) {
+ av_log(ctx, AV_LOG_ERROR, "Invalid delta pitch hrange; broken extradata?\n");
+ return -1;
+ }
s->block_delta_pitch_nbits = 1 + av_ceil_log2(s->block_delta_pitch_hrange);
s->block_pitch_range = s->block_conv_table[2] +
s->block_conv_table[3] + 1 +