]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/wmaprodec: Check offset
authorMichael Niedermayer <michael@niedermayer.cc>
Tue, 12 Nov 2019 19:06:35 +0000 (20:06 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Tue, 10 Dec 2019 15:09:14 +0000 (16:09 +0100)
Fixes: index 33280 out of bounds for type 'float [32768]'
Fixes: 18718/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XMA2_fuzzer-5635373899710464
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/wmaprodec.c

index 6a22e2f552ee0dbee08b2460a73630b5107008e4..775f17381fb61bd987e6e50c9a88839a415a2172 100644 (file)
@@ -1803,6 +1803,11 @@ static int xma_decode_packet(AVCodecContext *avctx, void *data,
     ret = decode_packet(avctx, &s->xma[s->current_stream], s->frames[s->current_stream],
                         &got_stream_frame_ptr, avpkt);
 
+    if (got_stream_frame_ptr && s->offset[s->current_stream] >= 64) {
+        got_stream_frame_ptr = 0;
+        ret = AVERROR_INVALIDDATA;
+    }
+
     /* copy stream samples (1/2ch) to sample buffer (Nch) */
     if (got_stream_frame_ptr) {
         int start_ch = s->start_channel[s->current_stream];