sys/xvimage/xvimagesink.c: Check that the xvimage we are creating has a correct size before returning it. (#3...

Original commit message from CVS:
2006-03-05  Julien MOUTTE  <julien@moutte.net>

* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_new),
(gst_xvimagesink_show_frame), (gst_xvimagesink_buffer_alloc):
Check that the xvimage we are creating has a correct size         before returning it. (#314897)
This commit is contained in:
Julien Moutte 2006-03-05 21:34:23 +00:00
parent 8bb1333c14
commit 3b285cc760
2 changed files with 14 additions and 2 deletions

View file

@ -1,3 +1,10 @@
2006-03-05 Julien MOUTTE <julien@moutte.net>
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_new),
(gst_xvimagesink_show_frame), (gst_xvimagesink_buffer_alloc):
Check that the xvimage we are creating has a correct size
before returning it. (#314897)
2006-03-05 Tim-Philipp Müller <tim at centricular dot net> 2006-03-05 Tim-Philipp Müller <tim at centricular dot net>
* gst/typefind/gsttypefindfunctions.c: (plugin_init): * gst/typefind/gsttypefindfunctions.c: (plugin_init):

View file

@ -473,7 +473,6 @@ gst_xvimagesink_xvimage_new (GstXvImageSink * xvimagesink, GstCaps * caps)
g_return_val_if_fail (GST_IS_XVIMAGESINK (xvimagesink), NULL); g_return_val_if_fail (GST_IS_XVIMAGESINK (xvimagesink), NULL);
xvimage = (GstXvImageBuffer *) gst_mini_object_new (GST_TYPE_XVIMAGE_BUFFER); xvimage = (GstXvImageBuffer *) gst_mini_object_new (GST_TYPE_XVIMAGE_BUFFER);
structure = gst_caps_get_structure (caps, 0); structure = gst_caps_get_structure (caps, 0);
@ -1834,7 +1833,8 @@ gst_xvimagesink_show_frame (GstBaseSink * bsink, GstBuffer * buf)
xvimagesink->xvimage = gst_xvimagesink_xvimage_new (xvimagesink, xvimagesink->xvimage = gst_xvimagesink_xvimage_new (xvimagesink,
GST_BUFFER_CAPS (buf)); GST_BUFFER_CAPS (buf));
if (!xvimagesink->xvimage) if ((!xvimagesink->xvimage) ||
(xvimagesink->xvimage->size < GST_BUFFER_SIZE (buf)))
goto no_image; goto no_image;
} }
@ -1976,6 +1976,11 @@ gst_xvimagesink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size,
/* We found no suitable image in the pool. Creating... */ /* We found no suitable image in the pool. Creating... */
GST_DEBUG_OBJECT (xvimagesink, "no usable image in pool, creating xvimage"); GST_DEBUG_OBJECT (xvimagesink, "no usable image in pool, creating xvimage");
xvimage = gst_xvimagesink_xvimage_new (xvimagesink, intersection); xvimage = gst_xvimagesink_xvimage_new (xvimagesink, intersection);
if (xvimage->size < size) {
/* This image is unusable. Destroying... */
gst_xvimage_buffer_free (xvimage);
xvimage = NULL;
}
} }
if (xvimage) { if (xvimage) {