Commit 64d340c6 authored by Stefano Sabatini's avatar Stefano Sabatini

lavf/utils: add error check in av_read_frame()

In particular, fix crash when the input file contains no packets (e.g. an
ffmeta input).
parent 127b70e4
...@@ -1409,12 +1409,19 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt) ...@@ -1409,12 +1409,19 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt)
AVStream *st; AVStream *st;
if (!genpts) { if (!genpts) {
ret = s->packet_buffer ? read_from_packet_buffer(&s->packet_buffer, while (1) {
&s->packet_buffer_end, ret = s->packet_buffer ?
pkt) : read_from_packet_buffer(&s->packet_buffer, &s->packet_buffer_end, pkt) :
read_frame_internal(s, pkt); read_frame_internal(s, pkt);
if (ret < 0) {
if (ret == AVERROR(EAGAIN))
continue;
else
return ret;
}
goto return_packet; goto return_packet;
} }
}
for (;;) { for (;;) {
AVPacketList *pktl = s->packet_buffer; AVPacketList *pktl = s->packet_buffer;
......
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