From 124f93a05d0e9578c0c324b1dadffbc8519930b9 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Wed, 14 Sep 2022 10:15:41 +0200 Subject: [PATCH] hlsdemux2: Fix crash on live playlist with single entry If there is a single entry, we would end up computing a minimum distance of 0, and would therefore read entries from after the segment array Part-of: --- subprojects/gst-plugins-good/ext/adaptivedemux2/hls/m3u8.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/m3u8.c b/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/m3u8.c index cc2fdceba2..3a68d16b54 100644 --- a/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/m3u8.c +++ b/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/m3u8.c @@ -1459,7 +1459,7 @@ gst_hls_media_playlist_get_seek_range (GstHLSMediaPlaylist * m3u8, first = g_ptr_array_index (m3u8->segments, 0); *start = first->stream_time; - if (GST_HLS_MEDIA_PLAYLIST_IS_LIVE (m3u8)) { + if (GST_HLS_MEDIA_PLAYLIST_IS_LIVE (m3u8) && m3u8->segments->len > 1) { /* min_distance is used to make sure the seek range is never closer than GST_M3U8_LIVE_MIN_FRAGMENT_DISTANCE fragments from the end of a live playlist - see 6.3.3. "Playing the Playlist file" of the HLS draft */