]> git.sesse.net Git - ffmpeg/commitdiff
avformat/mpegts: Check if ready on SCTE reception
authorAnthony Delannoy <anthony.2lannoy@gmail.com>
Tue, 3 Sep 2019 15:54:24 +0000 (17:54 +0200)
committerMarton Balint <cus@passwd.hu>
Tue, 3 Sep 2019 19:35:20 +0000 (21:35 +0200)
On some DVB stream SCTE-35 data packet are available before the end of
MpegTSContext initialization. We have to check if it is the case to
avoid a SEGFAULT.

Signed-off-by: Marton Balint <cus@passwd.hu>
libavformat/mpegts.c

index 58902527c581e0a1cd36c4cc82a5d6187310508a..0415ceea029895a1ffba16fe45b976cc0bc90ecc 100644 (file)
@@ -1725,6 +1725,13 @@ static void scte_data_cb(MpegTSFilter *filter, const uint8_t *section,
     if (idx < 0)
         return;
 
+    /**
+     * In case we receive an SCTE-35 packet before mpegts context is fully
+     * initialized.
+     */
+    if (!ts->pkt)
+        return;
+
     new_data_packet(section, section_len, ts->pkt);
     ts->pkt->stream_index = idx;
     prg = av_find_program_from_stream(ts->stream, NULL, idx);