asfdec: check stream_index for validity
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 3 Nov 2012 04:58:12 +0000 (05:58 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 3 Nov 2012 04:58:12 +0000 (05:58 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/asfdec.c

index 535d510..8843901 100644 (file)
@@ -975,7 +975,7 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){
             case 0x54:
                 aspect.num = avio_r8(pb);
                 aspect.den = avio_r8(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;
                     s->streams[asf->stream_index]->sample_aspect_ratio = aspect;
                 }
                 break;