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 772200 - gst_audio_buffer_clip() gsize underrun
gst_audio_buffer_clip() gsize underrun
Status: RESOLVED NOTGNOME
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal major
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-09-29 19:32 UTC by Stefan Sauer (gstreamer, gtkdoc dev)
Modified: 2016-10-20 13:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
don't deref NULL when gst_buffer_copy_region() failed (1.31 KB, patch)
2016-10-14 12:28 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
committed Details | Review
more diagnostics (3.96 KB, patch)
2016-10-14 12:29 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
none Details | Review
before after log snippet (2.05 KB, text/plain)
2016-10-14 17:41 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
  Details

Description Stefan Sauer (gstreamer, gtkdoc dev) 2016-09-29 19:32:12 UTC
Program received signal SIGTRAP, Trace/breakpoint trap.

Thread 140736406218496 (LWP 21227)

  • #0 g_logv
    at /build/buildd/glib2.0-2.40.2/./glib/gmessages.c line 1038
  • #1 g_log
    at /build/buildd/glib2.0-2.40.2/./glib/gmessages.c line 1071
  • #2 g_return_if_fail_warning
    at /build/buildd/glib2.0-2.40.2/./glib/gmessages.c line 1080
  • #3 gst_buffer_copy_into
  • #4 gst_buffer_copy_region
  • #5 gst_audio_buffer_clip
    at audio.c line 223
  • #6 gst_audio_filter_submit_input_buffer
    at gstaudiofilter.c line 177
  • #7 gst_base_transform_chain
    at gstbasetransform.c line 2326
  • #8 gst_pad_chain_data_unchecked
    at gstpad.c line 4205
  • #9 gst_pad_push_data
    at gstpad.c line 4457
  • #10 gst_pad_push
    at gstpad.c line 4576
  • #11 gst_base_src_loop
    at gstbasesrc.c line 2854
  • #12 gst_task_func
    at gsttask.c line 334
  • #13 g_thread_pool_thread_proxy
    at /build/buildd/glib2.0-2.40.2/./glib/gthreadpool.c line 307
  • #14 g_thread_proxy
    at /build/buildd/glib2.0-2.40.2/./glib/gthread.c line 764
  • #15 start_thread
    at pthread_create.c line 312
  • #16 clone
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S line 111

(gdb) call g_type_name(((GTypeClass*)(((GTypeInstance*) (btrans))->g_class))->g_type)
$1 = (const gchar *) 0x7fffc83dc2a8 "GstVolume"


tail -n20 /tmp/debug.log | grep 'audio'
0:00:25.007546763 23712      0x3106c50 DEBUG                  audio audio.c:108:gst_audio_buffer_clip: timestamp 0:00:07.625000000
0:00:25.007661049 23712      0x3106c50 LOG                    audio audio.c:142:gst_audio_buffer_clip: orig:  7625000000..7750000000 clipped 7625000000..7680000000
0:00:25.007699559 23712      0x3106c50 LOG                    audio audio.c:169:gst_audio_buffer_clip: clip stop:  6174 size 18446744073709550294
0:00:25.007744722 23712      0x3106c50 DEBUG                  audio audio.c:229:gst_audio_buffer_clip: trim 0 size 18446744073709550294 osize 4852

size was 4852 and becomes 18446744073709550294

trying to fix and ideally come up with a test
Comment 1 Stefan Sauer (gstreamer, gtkdoc dev) 2016-09-29 21:01:45 UTC
super weird, it just stopped happening. Downgrading the blocker status.
Comment 2 Stefan Sauer (gstreamer, gtkdoc dev) 2016-10-12 20:24:31 UTC
It is happening again. Audio is playing at 1/4 speed and this triggers the bad clipping. There are definitely bugs in the clipping for which I have patches.
Still not sure what is messing up the rate.
Comment 3 Stefan Sauer (gstreamer, gtkdoc dev) 2016-10-12 20:35:11 UTC
The low speed is a bug with distributing the tempo context in the pipeline.
Comment 4 Sebastian Dröge (slomo) 2016-10-13 09:14:56 UTC
You say you have patches, can you attach them? :) Do you know what the exact arguments to gst_audio_buffer_clip() are that break it (so we can write tests)?
Comment 5 Stefan Sauer (gstreamer, gtkdoc dev) 2016-10-14 12:28:25 UTC
Created attachment 337710 [details] [review]
don't deref NULL when gst_buffer_copy_region() failed

Ideally the parameters would be always valid.
Comment 6 Stefan Sauer (gstreamer, gtkdoc dev) 2016-10-14 12:29:00 UTC
Created attachment 337711 [details] [review]
more diagnostics

I am still working on a cut-down repro
Comment 7 Stefan Sauer (gstreamer, gtkdoc dev) 2016-10-14 17:39:57 UTC
It is essentially a bug on my side. My baseclass created buffers where duration and size was inconsistent at eof. Not sure how much we want to be forgiving here.

before the fix:
0:00:39.565873018 21337      0x41a1000 DEBUG             audiosynth src/lib/gst/audiosynth.c:440:gstbt_audio_synth_create:<simsyn:simsyn> generate_samples   5512, offset        77175, offset_end        82687 timestamp 0:00:01.750000000, duration 0:00:00.125000000
0:00:39.689102484 21337      0x41a1000 INFO              audiosynth src/lib/gst/audiosynth.c:377:gstbt_audio_synth_create:<simsyn:simsyn> partial buffer: 1985
0:00:39.689177367 21337      0x41a1000 DEBUG             audiosynth src/lib/gst/audiosynth.c:440:gstbt_audio_synth_create:<simsyn:simsyn> generate_samples   1985, offset        82687, offset_end        84672 timestamp 0:00:01.875000000, duration 0:00:00.125000000
0:00:39.689233702 21337      0x41a1000 DEBUG                  audio audio.c:108:gst_audio_buffer_clip: timestamp 0:00:01.875000000
0:00:39.689266587 21337      0x41a1000 LOG                    audio audio.c:169:gst_audio_buffer_clip: clip.stop size = 3970 - 7056
0:00:39.689279606 21337      0x41a1000 WARN                   audio audio.c:171:gst_audio_buffer_clip:  adjustment=7056 > size 3970
0:00:39.689290727 21337      0x41a1000 DEBUG                  audio audio.c:242:gst_audio_buffer_clip: trim 0 size 18446744073709548530 osize 3970


after fix:
0:00:15.463033287 29169      0x3364ad0 DEBUG             audiosynth src/lib/gst/audiosynth.c:443:gstbt_audio_synth_create:<simsyn:simsyn> generate_samples   5512, offset        77175, offset_end        82687 timestamp 0:00:01.750000000, duration 0:00:00.125000000
0:00:15.586788512 29169      0x3364ad0 INFO              audiosynth src/lib/gst/audiosynth.c:377:gstbt_audio_synth_create:<simsyn:simsyn> partial buffer: 1985
0:00:15.586884460 29169      0x3364ad0 DEBUG             audiosynth src/lib/gst/audiosynth.c:443:gstbt_audio_synth_create:<simsyn:simsyn> generate_samples   1985, offset        82687, offset_end        84672 timestamp 0:00: 01.875000000, duration 0:00:00.000000000
0:00:15.712021425 29169      0x3364ad0 WARN              audiosynth src/lib/gst/audiosynth.c:338:gstbt_audio_synth_create:<simsyn:simsyn> EOS reached
Comment 8 Stefan Sauer (gstreamer, gtkdoc dev) 2016-10-14 17:41:44 UTC
Created attachment 337738 [details]
before after log snippet

since the comment gets wrapped, here's it again
Comment 9 Stefan Sauer (gstreamer, gtkdoc dev) 2016-10-14 21:19:29 UTC
Figured it, doing tests. Need to cleanup the existing ones first.
Comment 10 Stefan Sauer (gstreamer, gtkdoc dev) 2016-10-15 20:56:33 UTC
Okay, 100% sure it is user error. I sent bad buffers. I cleanup the tests and added one more. I am fine with closing this. Any opinion on the "don't deref NULL when gst_buffer_copy_region() failed" patch? It should not really happen.
Comment 11 Matthew Waters (ystreet00) 2016-10-19 07:47:37 UTC
Review of attachment 337710 [details] [review]:

Being more careful is always good :)

Feel free to drop or push this and close the bug.
Comment 12 Sebastian Dröge (slomo) 2016-10-19 07:49:51 UTC
ACK, also feel free to add more checks to guard against invalid parameters (but not against invalid buffers).
Comment 13 Stefan Sauer (gstreamer, gtkdoc dev) 2016-10-20 13:44:18 UTC
Comment on attachment 337710 [details] [review]
don't deref NULL when gst_buffer_copy_region() failed

Added a GST_ERROR on in the failure case.
Comment 14 Stefan Sauer (gstreamer, gtkdoc dev) 2016-10-20 13:45:04 UTC
Closing the bug, since the root cause is in the element that created the buffer.