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 702617 - buffer: Wrong size/index handling when merging memory
buffer: Wrong size/index handling when merging memory
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
1.0.7
Other Linux
: Normal normal
: 1.0.8
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-06-19 06:39 UTC by Paul HENRYS
Modified: 2013-07-05 18:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch (1.23 KB, patch)
2013-06-19 06:39 UTC, Paul HENRYS
committed Details | Review

Description Paul HENRYS 2013-06-19 06:39:09 UTC
Created attachment 247230 [details] [review]
Patch

As explain in the title, it seems the size field and the condition to leave the for loop in _get_merged_memory of gstbuffer.c are wrong.
I noticed this with a custom element which was parsing the RTP buffers after rtph264pay element. rtph264pay or another element before might store the payload in more than one blocksize and when retrieving the payload in my element with gst_rtp_buffer_get_payload(), it merges internally the memory blocks containing the payload if necessary.
When the payload was stored in more than one block size, it was leading to get a buffer bigger of RTP header length size than before and messing up my data inside.
In the patch provided in attachment, I applied the following changes:

 - Set the size of the buffer containing the merged memory of the size of the memory blocks to be merged (and not the size of the full buffer)

 - Change the condition to leave the for loop from (i < length) to (i < idx+length) to handle cases where i > 0.
Comment 1 Sebastian Dröge (slomo) 2013-06-19 08:56:39 UTC
commit 4fc1ba1e603a9bb1522cf97a6466dbbc1673c9e9
Author: Sebastian Dröge <slomo@circular-chaos.org>
Date:   Wed Jun 19 10:45:45 2013 +0200

    buffer: Add unit test for map_range()
    
    https://bugzilla.gnome.org/show_bug.cgi?id=702617

commit db800445138425bb00b8cbf2ca601f9f7e15ac7e
Author: Paul HENRYS <visechelle@gmail.com>
Date:   Wed Jun 19 08:36:22 2013 +0200

    buffer: Fix wrong size/index handling when merging memory
    
    https://bugzilla.gnome.org/show_bug.cgi?id=702617
Comment 2 Tim-Philipp Müller 2013-07-05 18:37:37 UTC
cherry-picked this into 1.0 as well.