[Bug 773207] New: audio-converter: incorrect use of memcpy for in-place conversion in do_unpack()

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Wed Oct 19 08:51:40 UTC 2016


https://bugzilla.gnome.org/show_bug.cgi?id=773207

            Bug ID: 773207
           Summary: audio-converter: incorrect use of memcpy for in-place
                    conversion in do_unpack()
    Classification: Platform
           Product: GStreamer
           Version: 1.8.3
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: Normal
         Component: gst-plugins-base
          Assignee: gstreamer-bugs at lists.freedesktop.org
          Reporter: brain at jikos.cz
        QA Contact: gstreamer-bugs at lists.freedesktop.org
     GNOME version: ---

If in-place unpack is allowed and the format is the default format the
do_unpack() function calls memcpy with source and destination being the same
pointer. This is forbidden by the library standard:

"The memcpy() function copies n bytes from memory area src to memory area dest.
 The memory areas must not overlap.  Use memmove(3) if the memory areas do
overlap."

Therefore memmove should be used instead.

The code snippet from do_unpack() :

    if (in_writable && chain->allow_ip) {
      tmp = convert->in_data;
      GST_LOG ("unpack in-place %p, %" G_GSIZE_FORMAT, tmp, num_samples);
    } else {
...
    }

    if (convert->in_data) {
      for (i = 0; i < chain->blocks; i++) {
        if (convert->in_default) {
          GST_LOG ("copy %p, %p, %" G_GSIZE_FORMAT, tmp[i],
convert->in_data[i],
              num_samples);
          memcpy (tmp[i], convert->in_data[i], num_samples * chain->stride);
        } else {
...
        }
      }
    } else {
...

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list