From: Prashant Gotarne Date: Thu, 3 Sep 2015 03:28:08 +0000 (+0530) Subject: basetextoverlay: FIX crash if padding greater than video size X-Git-Tag: 1.19.3~511^2~3356 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7447736be963152637e0fbfac58e41241fe779a0;p=platform%2Fupstream%2Fgstreamer.git basetextoverlay: FIX crash if padding greater than video size Skipping rendering of textimage if overlay is completely outside video frame. https://bugzilla.gnome.org/show_bug.cgi?id=754429 --- diff --git a/ext/pango/gstbasetextoverlay.c b/ext/pango/gstbasetextoverlay.c index 54d9d1a..b373ef7f 100644 --- a/ext/pango/gstbasetextoverlay.c +++ b/ext/pango/gstbasetextoverlay.c @@ -1673,6 +1673,19 @@ gst_base_text_overlay_render_pangocairo (GstBaseTextOverlay * overlay, height = ceil (height * overlay->render_scale); scalef *= overlay->render_scale; + if (width <= 0 || height <= 0) { + g_mutex_unlock (GST_BASE_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock); + GST_DEBUG_OBJECT (overlay, + "Overlay is outside video frame. Skipping text rendering"); + return; + } + + if (unscaled_height <= 0 || unscaled_width <= 0) { + g_mutex_unlock (GST_BASE_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock); + GST_DEBUG_OBJECT (overlay, + "Overlay is outside video frame. Skipping text rendering"); + return; + } /* Prepare the transformation matrix. Note that the transformation happens * in reverse order. So for horizontal text, we will translate and then * scale. This is important to understand which scale shall be used. */