mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 18:05:37 +00:00
ext/pango/gsttextoverlay.c: Fix invalid memory access (we can't access a buffer after it's been pushed downstream wit...
Original commit message from CVS: * ext/pango/gsttextoverlay.c: (gst_text_overlay_render_text), (gst_text_overlay_video_chain): Fix invalid memory access (we can't access a buffer after it's been pushed downstream without taking a reference); fix memory leak (if there's no text to render, bail out before allocating stuff).
This commit is contained in:
parent
b80668c623
commit
bddbeccfdb
2 changed files with 14 additions and 7 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2006-03-07 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
|
* ext/pango/gsttextoverlay.c: (gst_text_overlay_render_text),
|
||||||
|
(gst_text_overlay_video_chain):
|
||||||
|
Fix invalid memory access (we can't access a buffer after it's been
|
||||||
|
pushed downstream without taking a reference); fix memory leak (if
|
||||||
|
there's no text to render, bail out before allocating stuff).
|
||||||
|
|
||||||
2006-03-07 Tim-Philipp Müller <tim at centricular dot net>
|
2006-03-07 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
* ext/pango/gsttextoverlay.c: (gst_text_overlay_init),
|
* ext/pango/gsttextoverlay.c: (gst_text_overlay_init),
|
||||||
|
|
|
@ -894,6 +894,11 @@ gst_text_overlay_render_text (GstTextOverlay * overlay,
|
||||||
PangoRectangle ink_rect, logical_rect;
|
PangoRectangle ink_rect, logical_rect;
|
||||||
gchar *string;
|
gchar *string;
|
||||||
|
|
||||||
|
if (!overlay->need_render) {
|
||||||
|
GST_DEBUG ("Using previously rendered text.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* -1 is the whole string */
|
/* -1 is the whole string */
|
||||||
if (text != NULL && textlen < 0) {
|
if (text != NULL && textlen < 0) {
|
||||||
textlen = strlen (text);
|
textlen = strlen (text);
|
||||||
|
@ -909,11 +914,6 @@ gst_text_overlay_render_text (GstTextOverlay * overlay,
|
||||||
|
|
||||||
/* FIXME: should we check for UTF-8 here? */
|
/* FIXME: should we check for UTF-8 here? */
|
||||||
|
|
||||||
if (!overlay->need_render) {
|
|
||||||
GST_DEBUG ("Using previously rendered text.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_DEBUG ("Rendering '%s'", string);
|
GST_DEBUG ("Rendering '%s'", string);
|
||||||
pango_layout_set_markup (overlay->layout, string, textlen);
|
pango_layout_set_markup (overlay->layout, string, textlen);
|
||||||
|
|
||||||
|
@ -1316,8 +1316,7 @@ gst_text_overlay_video_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
g_free (text);
|
g_free (text);
|
||||||
|
|
||||||
/* Update last_stop */
|
/* Update last_stop */
|
||||||
gst_segment_set_last_stop (overlay->segment, GST_FORMAT_TIME,
|
gst_segment_set_last_stop (overlay->segment, GST_FORMAT_TIME, clip_start);
|
||||||
GST_BUFFER_TIMESTAMP (buffer));
|
|
||||||
} else { /* Out of segment */
|
} else { /* Out of segment */
|
||||||
GST_OBJECT_UNLOCK (overlay);
|
GST_OBJECT_UNLOCK (overlay);
|
||||||
GST_DEBUG_OBJECT (overlay, "buffer out of segment discarding");
|
GST_DEBUG_OBJECT (overlay, "buffer out of segment discarding");
|
||||||
|
|
Loading…
Reference in a new issue