After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 708849 - hlsdemux: occasionally dereferencing NULL in gst_hls_demux_switch_playlist()
hlsdemux: occasionally dereferencing NULL in gst_hls_demux_switch_playlist()
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
1.2.0
Other Linux
: Normal normal
: 1.2.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-09-26 15:50 UTC by A Ashley
Modified: 2013-09-30 08:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix for NULL dereference (1.30 KB, patch)
2013-09-26 16:01 UTC, A Ashley
committed Details | Review

Description A Ashley 2013-09-26 15:50:24 UTC
When watching a live HLS stream, once or twice a minute I am getting assertion errors from gstreamer. For example:
0:03:40.982580889  7873   0x49d520 DEBUG               hlsdemux /data/alex.ashley/builds/gst_plugins_bad/ext/hls/gsthlsdemux.c:715:gst_hls_demux_stream_loop:<hlsdemux0> Enter task
0:03:40.983197112  7873   0x49d520 DEBUG               hlsdemux /data/alex.ashley/builds/gst_plugins_bad/ext/hls/gsthlsdemux.c:766:gst_hls_demux_stream_loop:<hlsdemux0> Pushing buffer 0x50f678
0:03:40.983746482  7873   0x49d520 DEBUG               hlsdemux /data/alex.ashley/builds/gst_plugins_bad/ext/hls/gsthlsdemux.c:772:gst_hls_demux_stream_loop:<hlsdemux0> Pushed buffer
0:03:40.984267741  7873   0x49d520 DEBUG               hlsdemux /data/alex.ashley/builds/gst_plugins_bad/ext/hls/gsthlsdemux.c:715:gst_hls_demux_stream_loop:<hlsdemux0> Enter task
0:03:40.984763963  7873   0x49d520 DEBUG               hlsdemux /data/alex.ashley/builds/gst_plugins_bad/ext/hls/gsthlsdemux.c:811:gst_hls_demux_stream_loop:<hlsdemux0> Pause task

** (gst-launch-1.0:7873): CRITICAL **: gst_fragment_get_buffer: assertion `fragment != NULL' failed

(gst-launch-1.0:7873): GStreamer-CRITICAL **: gst_buffer_get_sizes_range: assertion `GST_IS_BUFFER (buffer)' failed
0:03:40.986015853  7873   0x4a01b0 DEBUG               hlsdemux /data/alex.ashley/builds/gst_plugins_bad/ext/hls/gsthlsdemux.c:1240:gst_hls_demux_switch_playlist: Downloaded 0 bytes in 0:00:01.036940000. Bitrate is : 0

(gst-launch-1.0:7873): GStreamer-CRITICAL **: gst_mini_object_unref: assertion `mini_object != NULL' failed
0:03:40.987081519  7873   0x4a01b0 DEBUG               hlsdemux /data/alex.ashley/builds/gst_plugins_bad/ext/hls/gsthlsdemux.c:1209:gst_hls_demux_schedule:<hlsdemux0> Next update scheduled at 2013-09-26T15:27:46.895906Z
0:03:40.987728704  7873   0x4a01b0 DEBUG               hlsdemux /data/alex.ashley/builds/gst_plugins_bad/ext/hls/gsthlsdemux.c:887:gst_hls_demux_updates_loop:<hlsdemux0> Waiting

Tracing through the code, this is being caused by gst_hls_demux_switch_playlist because the fragment variable is NULL  and this function does not check for this situation.
Comment 1 A Ashley 2013-09-26 16:01:13 UTC
Created attachment 255850 [details] [review]
Fix for NULL dereference

This patch does two things:
* move the g_queue_peek_tail inside the semaphore protection
* check if q_queue_peek_tail returns NULL
Comment 2 Sebastian Dröge (slomo) 2013-09-28 11:14:49 UTC
commit 0bdf13c36ae61e150fe6c56d3c4a4e6ab3188ca2
Author: Alex Ashley <bugzilla@ashley-family.net>
Date:   Thu Sep 26 16:51:25 2013 +0100

    hlsdemux: Fix dereferencing of NULL pointer
    
    On some live HLS streams, gst_hls_demux_switch_playlist causes
    assertion failures because it tried to dereference a NULL fragment.
    This is because g_queue_peek_tail sometimes was returning NULL and
    this case was not being checked.
    
    This patch does two things:
    * move the g_queue_peek_tail inside the semaphore protection
    * check if q_queue_peek_tail returns NULL
    
    https://bugzilla.gnome.org/show_bug.cgi?id=708849