]> git.sesse.net Git - ffmpeg/commitdiff
avformat/asfdec_o: Check lang_idx
authorMichael Niedermayer <michael@niedermayer.cc>
Tue, 12 Jan 2021 20:45:38 +0000 (21:45 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Fri, 29 Jan 2021 18:36:46 +0000 (19:36 +0100)
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

index 3729adee2fdd9489b13bd8f2bfe48e8019e0ea13..c1d90360b45ac2dc6074801245280741f70144ab 100644 (file)
@@ -854,6 +854,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];