ffplay: Fix invalid array index
authorMichael Niedermayer <michael@niedermayer.cc>
Wed, 3 Aug 2016 11:15:14 +0000 (13:15 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 3 Aug 2016 14:09:03 +0000 (16:09 +0200)
Found-by: Thomas Guilbert <tguilbert@google.com>
Fixes: clusterfuzz_usan-2016-08-02
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
ffplay.c

index b0702eb..651e0cf 100644 (file)
--- a/ffplay.c
+++ b/ffplay.c
@@ -2936,7 +2936,7 @@ static int read_thread(void *arg)
         AVStream *st = ic->streams[i];
         enum AVMediaType type = st->codecpar->codec_type;
         st->discard = AVDISCARD_ALL;
-        if (wanted_stream_spec[type] && st_index[type] == -1)
+        if (type >= 0 && wanted_stream_spec[type] && st_index[type] == -1)
             if (avformat_match_stream_specifier(ic, st, wanted_stream_spec[type]) > 0)
                 st_index[type] = i;
     }