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 737199 - rtph264depay seg fault with IQEye camera
rtph264depay seg fault with IQEye camera
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
1.4.5
Other All
: Normal normal
: 1.4.6
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-09-23 16:58 UTC by Jake Foytik
Modified: 2015-02-05 01:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Logging for rtph264depay (360.31 KB, text/plain)
2014-09-23 16:58 UTC, Jake Foytik
  Details
rtph264depay: prevent trying to get 0 bytes from adapter (1.30 KB, patch)
2015-02-04 05:27 UTC, Thiago Sousa Santos
committed Details | Review

Description Jake Foytik 2014-09-23 16:58:28 UTC
Created attachment 286897 [details]
Logging for rtph264depay

Summary: Streaming H264 from an IQEye IP camera results in a Segmentation Fault for gstreamer 1.4.1.

Details:

The following pipeline fails with an IQEye camera and gstreamer 1.4.1 :
gst-launch-1.0 rtspsrc location="rtsp://admin:admin@192.168.103.124/rtsp/stream1" ! rtph264depay ! fakesink

However, this pipeline does work with gst-launch-0.10 (Provided in Ubuntu 14.04)

Looking at the stack trace, it appears the issue is associated with a gst_buffer_new_and_alloc() call in gstrtph264depay.c. See stack trace below : 

Program received signal SIGSEGV, Segmentation fault.

Thread 140736146175744 (LWP 32599)

  • #0 g_slice_alloc
    from /lib/x86_64-linux-gnu/libglib-2.0.so.0
  • #1 _sysmem_new_block
  • #2 default_alloc
    at gstallocator.c line 513
  • #3 gst_allocator_alloc
    at gstallocator.c line 311
  • #4 gst_buffer_new_allocate
    at gstbuffer.c line 669
  • #5 gst_rtp_h264_depay_process
    at gstrtph264depay.c line 1038
  • #6 gst_rtp_base_depayload_chain
    at gstrtpbasedepayload.c line 431
  • #7 gst_pad_chain_data_unchecked
    at gstpad.c line 3836
  • #8 gst_pad_push_data
    at gstpad.c line 4069
  • #9 gst_pad_push
    at gstpad.c line 4180
  • #10 gst_proxy_pad_chain_default
    at gstghostpad.c line 126
  • #11 gst_pad_chain_data_unchecked
    at gstpad.c line 3836
  • #12 gst_pad_push_data
    at gstpad.c line 4069
  • #13 gst_pad_push
    at gstpad.c line 4180
  • #14 gst_proxy_pad_chain_default
    at gstghostpad.c line 126
  • #15 gst_pad_chain_data_unchecked
    at gstpad.c line 3836
  • #16 gst_pad_push_data
    at gstpad.c line 4069
  • #17 gst_pad_push
    at gstpad.c line 4180
  • #18 gst_rtp_pt_demux_chain
    at gstrtpptdemux.c line 442
  • #19 gst_pad_chain_data_unchecked
    at gstpad.c line 3836
  • #20 gst_pad_push_data
    at gstpad.c line 4069
  • #21 gst_pad_push
    at gstpad.c line 4180
  • #22 pop_and_push_next
    at gstrtpjitterbuffer.c line 2541
  • #23 handle_next_buffer
    at gstrtpjitterbuffer.c line 2633
  • #24 gst_rtp_jitter_buffer_loop
    at gstrtpjitterbuffer.c line 3017
  • #25 gst_task_func
    at gsttask.c line 317
  • #26 default_func
    at gsttaskpool.c line 68
  • #27 ??
    from /lib/x86_64-linux-gnu/libglib-2.0.so.0
  • #28 ??
    from /lib/x86_64-linux-gnu/libglib-2.0.so.0
  • #29 start_thread
    at pthread_create.c line 312
  • #30 clone
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S line 111


Also, before the process crashes several gstreamer critical messages are posted :
** (gst-launch-1.0:385): CRITICAL **: gst_adapter_take_buffer: assertion 'nbytes > 0' failed

(gst-launch-1.0:385): GStreamer-CRITICAL **: gst_buffer_map_range: assertion 'GST_IS_BUFFER (buffer)' failed
0:00:00.391883630   385 0x7fffd4002540 DEBUG           rtph264depay gstrtph264depay.c:678:gst_rtp_h264_depay_handle_nal:<rtph264depay0> handle NAL type 8

(gst-launch-1.0:385): GStreamer-CRITICAL **: gst_buffer_get_sizes_range: assertion 'GST_IS_BUFFER (buffer)' failed

(gst-launch-1.0:385): GStreamer-CRITICAL **: gst_buffer_copy_region: assertion 'buffer != NULL' failed

(gst-launch-1.0:385): GStreamer-CRITICAL **: gst_buffer_map_range: assertion 'GST_IS_BUFFER (buffer)' failed

(gst-launch-1.0:385): GStreamer-CRITICAL **: gst_buffer_unmap: assertion 'GST_IS_BUFFER (buffer)' failed

(gst-launch-1.0:385): GStreamer-CRITICAL **: gst_buffer_unmap: assertion 'GST_IS_BUFFER (buffer)' failed

(gst-launch-1.0:385): GStreamer-CRITICAL **: gst_mini_object_unref: assertion 'mini_object != NULL' failed

I have attached a log file that contains the output of the process with gst-debug=rtph264depay:5.
Comment 1 Thiago Sousa Santos 2015-02-03 14:23:00 UTC
Can you run this pipeline under gdb with G_DEBUG=fatal_warnings so we stop at the first of those assertions? It likely is the root cause.

Also, perhaps you can provide a GDP payloaded stream from your camera so we can reproduce the issue?

gst-launch-1.0 -e  rtspsrc location="rtsp://admin:admin@192.168.103.124/rtsp/stream1" ! gdppay ! filesink location=stream.gdp

Let it run for some time that you judge would be enough to reproduce the issue and then ctrl-c and wait for it to close the file.

Did you try with git master to see if it is still reproducible?
Comment 2 Jake Foytik 2015-02-03 21:06:31 UTC
Further tests show that the pipeline fails for versions 1.4.1, 1.4.3, and 1.4.5. However the pipeline functions properly for versions 0.10 and 1.2.4.

Here is the output for the pipeline with gstreamer 1.4.5 in gdb with G_DEBUG=fatal_warnings:

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Setting pipeline to PAUSED ...
[New Thread 0x7ffff36f1700 (LWP 28795)]
Pipeline is live and does not need PREROLL ...
[New Thread 0x7ffff2ef0700 (LWP 28796)]
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://admin:admin@192.168.103.91/rtsp/stream1
[New Thread 0x7ffff199f700 (LWP 28797)]
Progress: (open) Retrieving server options
[New Thread 0x7ffff119e700 (LWP 28798)]
Progress: (open) Retrieving media info
Progress: (request) SETUP stream 0
[New Thread 0x7fffe3fff700 (LWP 28799)]
Progress: (request) SETUP stream 1
Progress: (open) Opened Stream
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Progress: (request) Sending PLAY request
[New Thread 0x7fffe37fe700 (LWP 28800)]
[New Thread 0x7fffe2ffd700 (LWP 28801)]
[New Thread 0x7fffe27fc700 (LWP 28802)]
[New Thread 0x7fffe1ffb700 (LWP 28803)]
[New Thread 0x7fffe17fa700 (LWP 28804)]
[New Thread 0x7fffe0ff9700 (LWP 28805)]
[New Thread 0x7fffc3fff700 (LWP 28806)]
[New Thread 0x7fffc37fe700 (LWP 28807)]
Progress: (request) Sending PLAY request
Progress: (request) Sent PLAY request
[New Thread 0x7fffc2ffd700 (LWP 28808)]
[New Thread 0x7fffc27fc700 (LWP 28809)]
[New Thread 0x7fffc1ffb700 (LWP 28810)]
[New Thread 0x7fffc17fa700 (LWP 28811)]

** (gst-launch-1.0:28791): CRITICAL **: gst_adapter_take_buffer: assertion 'nbytes > 0' failed

Program received signal SIGTRAP, Trace/breakpoint trap.

Thread 140736439756544 (LWP 28811)

  • #0 g_logv
    from /lib/x86_64-linux-gnu/libglib-2.0.so.0
  • #1 g_log
    from /lib/x86_64-linux-gnu/libglib-2.0.so.0
  • #2 gst_adapter_take_buffer
    at gstadapter.c line 854
  • #3 gst_rtp_h264_depay_process
    at gstrtph264depay.c line 958
  • #4 gst_rtp_base_depayload_chain
    at gstrtpbasedepayload.c line 431
  • #5 gst_pad_chain_data_unchecked
    at gstpad.c line 3838
  • #6 gst_pad_push_data
    at gstpad.c line 4071
  • #7 gst_pad_push
    at gstpad.c line 4182
  • #8 gst_proxy_pad_chain_default
    at gstghostpad.c line 126
  • #9 gst_pad_chain_data_unchecked
    at gstpad.c line 3838
  • #10 gst_pad_push_data
    at gstpad.c line 4071
  • #11 gst_pad_push
    at gstpad.c line 4182
  • #12 gst_proxy_pad_chain_default
    at gstghostpad.c line 126
  • #13 gst_pad_chain_data_unchecked
    at gstpad.c line 3838
  • #14 gst_pad_push_data
    at gstpad.c line 4071
  • #15 gst_pad_push
    at gstpad.c line 4182
  • #16 gst_rtp_pt_demux_chain
    at gstrtpptdemux.c line 442
  • #17 gst_pad_chain_data_unchecked
    at gstpad.c line 3838
  • #18 gst_pad_push_data
    at gstpad.c line 4071
  • #19 gst_pad_push
    at gstpad.c line 4182
  • #20 pop_and_push_next
    at gstrtpjitterbuffer.c line 2543
  • #21 handle_next_buffer
    at gstrtpjitterbuffer.c line 2635
  • #22 gst_rtp_jitter_buffer_loop
    at gstrtpjitterbuffer.c line 3025
  • #23 gst_task_func
    at gsttask.c line 331
  • #24 ??
    from /lib/x86_64-linux-gnu/libglib-2.0.so.0
  • #25 ??
    from /lib/x86_64-linux-gnu/libglib-2.0.so.0
  • #26 start_thread
    at pthread_create.c line 312
  • #27 clone
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S line 111

Comment 3 Jake Foytik 2015-02-03 21:15:47 UTC
The GDP Payload file was too large to post, so I've shared it with google drive at the following link:
https://drive.google.com/file/d/0B1--lpqjOQNwX1RzWlJHWWxLNThNeVNVanRLZW82R0FBMmpZ/view?usp=sharing

This is the GDP payload for the IQEye camera generated with the following pipeline:

gst-launch-1.0 -e  rtspsrc
location="rtsp://admin:admin@192.168.103.124/rtsp/stream1" ! gdppay ! filesink
location=stream.gdp
Comment 4 Thiago Sousa Santos 2015-02-04 05:27:02 UTC
Created attachment 296064 [details] [review]
rtph264depay: prevent trying to get 0 bytes from adapter

Thanks for the quick reply. Could you check if this patch fixes
the issue for you?
Comment 5 Jake Foytik 2015-02-04 12:42:22 UTC
The patch fixes this issue. Thanks for the help.
Comment 6 Thiago Sousa Santos 2015-02-05 01:01:14 UTC
commit a6d73797d091a0e4ac33eaf516056103f7ffb1e8
Author: Thiago Santos <thiagoss@osg.samsung.com>
Date:   Wed Feb 4 02:25:44 2015 -0300

    rtph264depay: prevent trying to get 0 bytes from adapter
    
    This causes an assertion and would lead to getting a NULL instead
    of a buffer. Without proper checking this would easily lead to
    a segfault
    
    https://bugzilla.gnome.org/show_bug.cgi?id=737199

And in 1.4:
commit fe99398062dc95cfff2d47c46fcc7be94d46abcc
Author: Thiago Santos <thiagoss@osg.samsung.com>
Date:   Wed Feb 4 02:25:44 2015 -0300

    rtph264depay: prevent trying to get 0 bytes from adapter
    
    This causes an assertion and would lead to getting a NULL instead
    of a buffer. Without proper checking this would easily lead to
    a segfault
    
    https://bugzilla.gnome.org/show_bug.cgi?id=737199