asfdec: check stream_index for validity
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 3 Nov 2012 04:58:12 +0000 (05:58 +0100)
committerCarl Eugen Hoyos <cehoyos@ag.or.at>
Mon, 10 Dec 2012 22:57:14 +0000 (23:57 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b7280cff9a7683395d7f899517b4aea8b52f12a4)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/asfdec.c

index 8509008..20f212f 100644 (file)
@@ -972,7 +972,7 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){
             case 0x54:
                 aspect.num = avio_r8(pb);
                 aspect.den = avio_r8(pb);
-                if (aspect.num > 0 && aspect.den > 0) {
+                if (aspect.num > 0 && aspect.den > 0 && asf->stream_index >= 0) {
                     s->streams[asf->stream_index]->sample_aspect_ratio = aspect;
                 }
                 break;