[gst-cvs] gst-plugins-good: multipartdemux: avoid reading from inavlid memory

Wim Taymans wtay at kemper.freedesktop.org
Tue May 5 08:08:50 PDT 2009


Module: gst-plugins-good
Branch: master
Commit: 439ca2c7959f6d72aa649b6d676ea4b6caf2c043
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=439ca2c7959f6d72aa649b6d676ea4b6caf2c043

Author: Arnout Vandecappelle <arnout at mind.be>
Date:   Tue May  5 17:07:13 2009 +0200

multipartdemux: avoid reading from inavlid memory

Read the timestamp of the incomming buffer before we push it in the adapter and
flush it out again as the buffer might be unreffed then and we read from invalid
memory.
Fixes #581444.

---

 gst/multipart/multipartdemux.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/gst/multipart/multipartdemux.c b/gst/multipart/multipartdemux.c
index 5f6c707..3187920 100644
--- a/gst/multipart/multipartdemux.c
+++ b/gst/multipart/multipartdemux.c
@@ -469,6 +469,7 @@ gst_multipart_demux_chain (GstPad * pad, GstBuffer * buf)
 {
   GstMultipartDemux *multipart;
   GstAdapter *adapter;
+  GstClockTime timestamp;
   gint size = 1;
   GstFlowReturn res;
 
@@ -477,6 +478,8 @@ gst_multipart_demux_chain (GstPad * pad, GstBuffer * buf)
 
   res = GST_FLOW_OK;
 
+  timestamp = GST_BUFFER_TIMESTAMP (buf);
+
   if (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DISCONT)) {
     gst_adapter_clear (adapter);
   }
@@ -518,7 +521,7 @@ gst_multipart_demux_chain (GstPad * pad, GstBuffer * buf)
       gst_pad_push_event (srcpad->pad, event);
       GST_BUFFER_TIMESTAMP (outbuf) = 0;
     } else {
-      GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf);
+      GST_BUFFER_TIMESTAMP (outbuf) = timestamp;
     }
     GST_DEBUG_OBJECT (multipart,
         "pushing buffer with timestamp %" GST_TIME_FORMAT,





More information about the Gstreamer-commits mailing list