[Bug 677994] New: Element.SetDetails() crashes due to wrong heap

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Wed Jun 13 03:03:04 PDT 2012


https://bugzilla.gnome.org/show_bug.cgi?id=677994
  GStreamer | gst-sharp | git

           Summary: Element.SetDetails() crashes due to wrong heap
    Classification: Platform
           Product: GStreamer
           Version: git
        OS/Version: Windows
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: gst-sharp
        AssignedTo: gstreamer-bugs at lists.freedesktop.org
        ReportedBy: jpa at gnobug.mail.kapsi.fi
         QAContact: gstreamer-bugs at lists.freedesktop.org
     GNOME version: ---


Created an attachment (id=216251)
 --> (https://bugzilla.gnome.org/attachment.cgi?id=216251)
patch

Calling Element.SetDetails() on an element subclass that overrides e.g.
OnChangeState() or binds events otherwise crashes in g_free().

Reason boils down to wrong marshalling of string fields.
Element.GstElementClass contains ElementDetails, which in turn contains string
fields for the description etc. Currently they are declared as 'string' in C#,
which causes Marshal.StructureToPtr() to allocate them using SysAllocString().

Under Windows atleast, SysAllocString() uses a different heap than g_malloc(),
so the string fields cannot be freed using g_free(). The code in
gst_element_set_details_simple() tries to do exactly this and crashes.

This patch changes the ElementDetails string fields to IntPtr to avoid
unnecessary marshaling and reallocation. ElementDetails is declared as internal
and not used elsewhere, so changing the types does not affect applications.

-- 
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