Revision 074ac3c2 libavformat/matroskadec.c

View differences:

libavformat/matroskadec.c
2356 2356
            MatroskaDemuxIndex *idx = &matroska->index[i];
2357 2357
            track = matroska_find_track_by_num(matroska, idx->track);
2358 2358
            stream = matroska->tracks[track]->stream_index;
2359
            if (stream >= 0)
2359
            if (stream >= 0 && stream < matroska->ctx->nb_streams)
2360 2360
                av_add_index_entry(matroska->ctx->streams[stream],
2361 2361
                                   idx->pos, idx->time/matroska->time_scale,
2362 2362
                                   0, 0, AVINDEX_KEYFRAME);
......
2400 2400
        return res;
2401 2401
    }
2402 2402
    stream_index = matroska->tracks[track]->stream_index;
2403
    if (stream_index < 0) {
2403
    if (stream_index < 0 || stream_index >= matroska->ctx->nb_streams) {
2404 2404
        av_free(origdata);
2405 2405
        return res;
2406 2406
    }

Also available in: Unified diff