aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-12-05 13:48:06 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2015-12-05 14:35:37 +0100
commit66e05f6ff5e5c105bdd7bf3a49234ddac1b592c5 (patch)
treee56c60694f816fbca930f0ec551df199db228cfd
parent15d14ce47cb39b93a80a2c6b8396db81c16934e6 (diff)
downloadffmpeg-66e05f6ff5e5c105bdd7bf3a49234ddac1b592c5.tar.gz
avcodec/wmaprodec: Check bits per sample to be within the range not causing integer overflows
Fixes: 549d5aab1480d10f2a775ed90b0342f1/signal_sigabrt_7ffff6ae7cc9_5643_96bbb0cfe3e28be1dadfce1075016345.wma Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/wmaprodec.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index 5396733dce..f8f901c224 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -338,6 +338,12 @@ static av_cold int decode_init(AVCodecContext *avctx)
s->decode_flags = AV_RL16(edata_ptr+14);
channel_mask = AV_RL32(edata_ptr+2);
s->bits_per_sample = AV_RL16(edata_ptr);
+
+ if (s->bits_per_sample > 32 || s->bits_per_sample < 1) {
+ avpriv_request_sample(avctx, "bits per sample is %d", s->bits_per_sample);
+ return AVERROR_PATCHWELCOME;
+ }
+
/** dump the extradata */
for (i = 0; i < avctx->extradata_size; i++)
ff_dlog(avctx, "[%x] ", avctx->extradata[i]);