[Bug 677560] rtpjpegdepay: crash in copy_into_unchecked

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Mon Sep 3 09:58:14 PDT 2012


https://bugzilla.gnome.org/show_bug.cgi?id=677560
  GStreamer | gst-plugins-good | 0.10.36

--- Comment #9 from allopez <allopez at gmv.com> 2012-09-03 16:58:09 UTC ---
This changes made the trick at gstreamer-0.10.36/libs/gst/base/gstadapter.c:

/* copy data into @dest, skipping @skip bytes from the head buffers */
static void
copy_into_unchecked (GstAdapter * adapter, guint8 * dest, guint skip,
    guint size)
{
  GSList *g;
  GstBuffer *buf;
  guint bsize, csize;

  /* first step, do skipping */
  /* we might well be copying where we were scanning */
  if (adapter->priv->scan_entry && (adapter->priv->scan_offset <= skip)) 
  {
    g = adapter->priv->scan_entry;
    skip -= adapter->priv->scan_offset;
  }
  else 
  {
    g = adapter->buflist;
  }

  buf = g->data;
  bsize = GST_BUFFER_SIZE (buf);

  while (G_UNLIKELY (skip >= bsize)) 
  {
            skip -= bsize;
        g = g_slist_next (g);
        /********************/
        if(g != NULL)
        {
                buf = g->data;
            bsize = GST_BUFFER_SIZE (buf);
        }
        else
            break;
        /********************/


  }
  /* copy partial buffer */
  csize = MIN (bsize - skip, size);
  memcpy (dest, GST_BUFFER_DATA (buf) + skip, csize);
  size -= csize;
  dest += csize;

  /* second step, copy remainder */
  while (size > 0) 
  {
    g = g_slist_next (g);
    /********************/
    if(g != NULL)
    {    
        buf = g->data;
        bsize = GST_BUFFER_SIZE (buf);
        if (G_LIKELY (bsize > 0)) 
        {
            csize = MIN (bsize, size);
                  memcpy (dest, GST_BUFFER_DATA (buf), csize);
                  size -= csize;
                  dest += csize;
        }
    }
    else 
        break;
    /********************/
  }
}

-- 
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- 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