slomo gst-plugins-base: gst-plugins-base/ gst-plugins-base/ext/gio/ gst-plugins-base/ext/gnomevfs/

[email protected]
Newsgroups gmane.comp.video.gstreamer.cvs
Message-ID <[email protected]>
CVS Root:       /cvs/gstreamer
Module:         gst-plugins-base
Changes by:     slomo
Date:           Mon Nov 24 2008  12:07:25 UTC

Log message:
* ext/gio/gstgiobasesrc.c: (gst_gio_base_src_create):
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnome_vfs_src_create):
Use gst_buffer_try_new_and_alloc() and fail properly if the
allocation failed. This prevents abort() if downstream elements
request an insane amount of memory.

Modified files:
    .               : ChangeLog
    ext/gio         : gstgiobasesrc.c
    ext/gnomevfs    : gstgnomevfssrc.c

Links:
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.4208&r2=1.4209
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ext/gio/gstgiobasesrc.c.diff?r1=1.9&r2=1.10
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ext/gnomevfs/gstgnomevfssrc.c.diff?r1=1.107&r2=1.108

====Begin Diffs====
Index: ChangeLog
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v
retrieving revision 1.4208
retrieving revision 1.4209
diff -u -d -r1.4208 -r1.4209
--- ChangeLog	24 Nov 2008 12:03:09 -0000	1.4208
+++ ChangeLog	24 Nov 2008 12:07:09 -0000	1.4209
@@ -1,3 +1,11 @@
+2008-11-24  Sebastian Dröge  <[email protected]>
+
+	* ext/gio/gstgiobasesrc.c: (gst_gio_base_src_create):
+	* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnome_vfs_src_create):
+	Use gst_buffer_try_new_and_alloc() and fail properly if the
+	allocation failed. This prevents abort() if downstream elements
+	request an insane amount of memory.
 2008-11-24  Wim Taymans  <[email protected]>
 
 	* gst/volume/gstvolume.c: (volume_choose_func),
Index: gstgiobasesrc.c
RCS file: /cvs/gstreamer/gst-plugins-base/ext/gio/gstgiobasesrc.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- gstgiobasesrc.c	11 Jun 2008 09:35:51 -0000	1.9
+++ gstgiobasesrc.c	24 Nov 2008 12:07:10 -0000	1.10
@@ -317,9 +317,7 @@
     GstBuffer ** buf_return)
 {
   GstGioBaseSrc *src = GST_GIO_BASE_SRC (base_src);
-
   GstBuffer *buf;
   GstFlowReturn ret = GST_FLOW_OK;
   g_return_val_if_fail (G_IS_INPUT_STREAM (src->stream), GST_FLOW_ERROR);
@@ -369,7 +367,11 @@
         return ret;
     }
-    src->cache = gst_buffer_new_and_alloc (cachesize);
+    src->cache = gst_buffer_try_new_and_alloc (cachesize);
+    if (G_UNLIKELY (src->cache == NULL)) {
+      GST_ERROR_OBJECT (src, "Failed to allocate %u bytes", cachesize);
+      return GST_FLOW_ERROR;
+    }
     GST_LOG_OBJECT (src, "Reading %u bytes from offset %" G_GUINT64_FORMAT,
         cachesize, offset);
Index: gstgnomevfssrc.c
RCS file: /cvs/gstreamer/gst-plugins-base/ext/gnomevfs/gstgnomevfssrc.c,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -d -r1.107 -r1.108
--- gstgnomevfssrc.c	29 Jul 2008 12:35:54 -0000	1.107
+++ gstgnomevfssrc.c	24 Nov 2008 12:07:10 -0000	1.108
@@ -625,7 +625,11 @@
   }
-  buf = gst_buffer_new_and_alloc (size);
+  buf = gst_buffer_try_new_and_alloc (size);
+  if (G_UNLIKELY (buf == NULL && size == 0)) {
+    GST_ERROR_OBJECT (src, "Failed to allocate %u bytes", size);
+    return GST_FLOW_ERROR;
+  }
   data = GST_BUFFER_DATA (buf);

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

_______________________________________________
gstreamer-cvs-verbose mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gstreamer-cvs-verbose
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.