Skip to content

Commit

Permalink
Validate AV stream index before accessing stream.
Browse files Browse the repository at this point in the history
Fixes #528.

(cherry picked from commit d479280)
  • Loading branch information
linuxdude42 committed Mar 25, 2022
1 parent 5432d11 commit f69ce76
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mythtv/libs/libmythtv/decoders/avformatdecoder.cpp
Expand Up @@ -4133,7 +4133,9 @@ QString AvFormatDecoder::GetTrackDesc(uint type, uint TrackNo)
QString forcedString = forced ? QObject::tr(" (forced)") : "";

int av_index = m_tracks[type][TrackNo].m_av_stream_index;
AVStream *stream = m_ic->streams[av_index];
AVStream *stream { nullptr };
if (av_index >= 0 && av_index < m_ic->nb_streams)
stream = m_ic->streams[av_index];
AVDictionaryEntry *entry =
stream ? av_dict_get(stream->metadata, "title", NULL, 0) : nullptr;
QString user_title = entry ? QString(R"( "%1")").arg(entry->value) : "";
Expand Down

0 comments on commit f69ce76

Please sign in to comment.