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 706162 - gst_buffer_memcmp() ignores the buffer size if it goes past the gstbuffer
gst_buffer_memcmp() ignores the buffer size if it goes past the gstbuffer
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal normal
: 1.1.4
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-08-16 19:33 UTC by Olivier Crête
Modified: 2013-08-20 18:42 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
buffer: Fix gst_buffer_memcmp() where the buffer is smaller (2.42 KB, patch)
2013-08-16 19:33 UTC, Olivier Crête
needs-work Details | Review
buffer: Fix gst_buffer_memcmp() where the buffer is smaller than size (2.57 KB, patch)
2013-08-19 18:58 UTC, Olivier Crête
committed Details | Review

Description Olivier Crête 2013-08-16 19:33:06 UTC
Created attachment 251936 [details] [review]
buffer: Fix gst_buffer_memcmp() where the buffer is smaller

If the arguments to gst_buffer_memcmp() go past the end of the gstbuffer, the gst_buffer_memcmp() returns 0, while it should probably return that the buffers are not equal.
Comment 1 Tim-Philipp Müller 2013-08-16 20:49:01 UTC
Or maybe the caller should check and it should be regarded as a programming error?
Comment 2 Olivier Crête 2013-08-16 21:07:56 UTC
In that case, we may want to add a g_return_val_if_fail() in there
Comment 3 Wim Taymans 2013-08-17 13:37:22 UTC
I think the function should first check the sizes and return -1/1 if it doesn't match.
Comment 4 Sebastian Dröge (slomo) 2013-08-19 08:17:24 UTC
Yeah, checking sizes in the very beginning before doing anything else and then returning not-0 immediately sounds best to me too.
Comment 5 Olivier Crête 2013-08-19 18:58:02 UTC
Created attachment 252275 [details] [review]
buffer: Fix gst_buffer_memcmp() where the buffer is smaller than size

Alternate patch that checks the size first.
Comment 6 Sebastian Dröge (slomo) 2013-08-20 07:41:07 UTC
Review of attachment 252275 [details] [review]:

Looks good, ship it :)
Comment 7 Olivier Crête 2013-08-20 18:41:54 UTC
Committed

commit f90f3cde5f165daa99b9756eba4b98bc26aa1362
Author: Olivier Crête <olivier.crete@collabora.com>
Date:   Mon Aug 19 14:55:22 2013 -0400

    buffer: Fix gst_buffer_memcmp() where the buffer is smaller than size
    
    Also add unit tests for gst_buffer_memcmp
    
    https://bugzilla.gnome.org/show_bug.cgi?id=706162