Skip to content

Commit

Permalink
demux_lavf: fix null derefence of stream variable
Browse files Browse the repository at this point in the history
demux_stream_is_selected() already checks if stream is valid, so move
the image format hack check after that.

Fixes: 4ef7931
  • Loading branch information
kasper93 committed Jun 15, 2024
1 parent ab0a508 commit 6c90836
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions demux/demux_lavf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1260,15 +1260,15 @@ static bool demux_lavf_read_packet(struct demuxer *demux,
struct sh_stream *stream = info->sh;
AVStream *st = priv->avfc->streams[pkt->stream_index];

// Never send additional frames for streams that are a single frame.
if (stream->image && priv->format_hack.first_frame_only && pkt->pos != 0) {
if (!demux_stream_is_selected(stream)) {
av_packet_unref(pkt);
return true;
return true; // don't signal EOF if skipping a packet
}

if (!demux_stream_is_selected(stream)) {
// Never send additional frames for streams that are a single frame.
if (stream->image && priv->format_hack.first_frame_only && pkt->pos != 0) {
av_packet_unref(pkt);
return true; // don't signal EOF if skipping a packet
return true;
}

struct demux_packet *dp = new_demux_packet_from_avpacket(pkt);
Expand Down

0 comments on commit 6c90836

Please sign in to comment.