From 1fec7097926395c0a49f1e714b086129edc8ab09 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 25 Feb 2009 12:05:22 +0100 Subject: [PATCH] avidemux: avoid crashing on subtitles Avoid a crash in avi with subtitles by only dereferencing the video description when we actually are dealing with video in the _invert function. --- gst/avi/gstavidemux.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gst/avi/gstavidemux.c b/gst/avi/gstavidemux.c index 2473b922ce..017a7f5806 100644 --- a/gst/avi/gstavidemux.c +++ b/gst/avi/gstavidemux.c @@ -3599,7 +3599,7 @@ static GstBuffer * gst_avi_demux_invert (avi_stream_context * stream, GstBuffer * buf) { GstStructure *s; - gint y, h = stream->strf.vids->height; + gint y, w, h; gint bpp, stride; guint8 *tmp = NULL; @@ -3616,7 +3616,14 @@ gst_avi_demux_invert (avi_stream_context * stream, GstBuffer * buf) return buf; } - stride = stream->strf.vids->width * (bpp / 8); + if (stream->strf.vids == NULL) { + GST_WARNING ("Failed to retrieve vids for stream"); + return buf; + } + + h = stream->strf.vids->height; + w = stream->strf.vids->width; + stride = w * (bpp / 8); buf = gst_buffer_make_writable (buf); if (GST_BUFFER_SIZE (buf) < (stride * h)) {