Commit fdb2d4b1 authored by Marton Balint's avatar Marton Balint

lavf/concatdec: do not access packet if av_read_frame returned error

Reviewed-by: 's avatarNicolas George <george@nsup.org>
Signed-off-by: 's avatarMarton Balint <cus@passwd.hu>
parent a43deea8
...@@ -555,9 +555,7 @@ static int concat_read_packet(AVFormatContext *avf, AVPacket *pkt) ...@@ -555,9 +555,7 @@ static int concat_read_packet(AVFormatContext *avf, AVPacket *pkt)
while (1) { while (1) {
ret = av_read_frame(cat->avf, pkt); ret = av_read_frame(cat->avf, pkt);
if (ret == AVERROR_EOF || packet_after_outpoint(cat, pkt)) { if (ret == AVERROR_EOF) {
if (ret == 0)
av_packet_unref(pkt);
if ((ret = open_next_file(avf)) < 0) if ((ret = open_next_file(avf)) < 0)
return ret; return ret;
continue; continue;
...@@ -568,6 +566,12 @@ static int concat_read_packet(AVFormatContext *avf, AVPacket *pkt) ...@@ -568,6 +566,12 @@ static int concat_read_packet(AVFormatContext *avf, AVPacket *pkt)
av_packet_unref(pkt); av_packet_unref(pkt);
return ret; return ret;
} }
if (packet_after_outpoint(cat, pkt)) {
av_packet_unref(pkt);
if ((ret = open_next_file(avf)) < 0)
return ret;
continue;
}
cs = &cat->cur_file->streams[pkt->stream_index]; cs = &cat->cur_file->streams[pkt->stream_index];
if (cs->out_stream_index < 0) { if (cs->out_stream_index < 0) {
av_packet_unref(pkt); av_packet_unref(pkt);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment