diff options
author | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2008-05-29 15:22:45 +0000 |
---|---|---|
committer | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2008-05-29 15:22:45 +0000 |
commit | 6c10281c3a3c5fe0ce9c5943ed94c73ebd0a5209 (patch) | |
tree | 84523f3aa305404b2ddf296c3a2c74f15e9debd3 /libavformat/gxf.c | |
parent | 1ab05d37ff32f0abfcfcc64a62a208482af9baae (diff) | |
download | ffmpeg-6c10281c3a3c5fe0ce9c5943ed94c73ebd0a5209.tar.gz |
Check for av_new_stream failure, fixes CID76 RUN2
Originally committed as revision 13533 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/gxf.c')
-rw-r--r-- | libavformat/gxf.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libavformat/gxf.c b/libavformat/gxf.c index a0c98b2238..5a0675fe2d 100644 --- a/libavformat/gxf.c +++ b/libavformat/gxf.c @@ -82,6 +82,8 @@ static int get_sindex(AVFormatContext *s, int id, int format) { return i; } st = av_new_stream(s, id); + if (!st) + return AVERROR(ENOMEM); switch (format) { case 3: case 4: @@ -415,6 +417,7 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) { while (!url_feof(pb)) { int track_type, track_id, ret; int field_nr; + int stream_index; if (!parse_packet_header(pb, &pkt_type, &pkt_len)) { if (!url_feof(pb)) av_log(s, AV_LOG_ERROR, "GXF: sync lost\n"); @@ -435,6 +438,9 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) { pkt_len -= 16; track_type = get_byte(pb); track_id = get_byte(pb); + stream_index = get_sindex(s, track_id, track_type); + if (stream_index < 0) + return stream_index; field_nr = get_be32(pb); get_be32(pb); // field information get_be32(pb); // "timeline" field number @@ -444,7 +450,7 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) { // field information, it might be better to take this into account // as well. ret = av_get_packet(pb, pkt, pkt_len); - pkt->stream_index = get_sindex(s, track_id, track_type); + pkt->stream_index = stream_index; pkt->dts = field_nr; return ret; } |