diff mbox series

[FFmpeg-devel,2/4] avformat/asfdec_o: Check lang_idx

Message ID 20210112215116.21186-2-michael@niedermayer.cc
State Accepted
Commit 06e5c791949b63555aa4305df6ce9d2ffa45ec90
Headers show
Series [FFmpeg-devel,1/4] avformat/asfdec_o: Check size vs. offset in detect_unknown_subobject() | expand


Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Michael Niedermayer Jan. 12, 2021, 9:51 p.m. UTC
Fixes: index 26981 out of bounds for type 'ASFStreamData [128]'
Fixes: 27334/clusterfuzz-testcase-minimized-ffmpeg_dem_ASF_O_fuzzer-6197611002068992

Alternatively the array could be increased in size or the cases not fitting be ignored

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
 libavformat/asfdec_o.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series


diff --git a/libavformat/asfdec_o.c b/libavformat/asfdec_o.c
index 6ce5a3fb43..0a65850059 100644
--- a/libavformat/asfdec_o.c
+++ b/libavformat/asfdec_o.c
@@ -851,6 +851,8 @@  static int asf_read_ext_stream_properties(AVFormatContext *s, const GUIDParseTab
     st_num     = avio_rl16(pb);
     st_num    &= ASF_STREAM_NUM;
     lang_idx   = avio_rl16(pb); // Stream Language ID Index
+    if (lang_idx >= ASF_MAX_STREAMS)
+        return AVERROR_INVALIDDATA;
     for (i = 0; i < asf->nb_streams; i++) {
         if (st_num == asf->asf_st[i]->stream_index) {
             st                       = s->streams[asf->asf_st[i]->index];