From 7e9dffa2266bb9c32a778335745cafc41e205d44 Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Tue, 24 Jul 2012 12:33:33 +0200 Subject: [PATCH] matroskademux: avoid NULL access when checking subtitle Fixes https://bugzilla.gnome.org/show_bug.cgi?id=680388 --- gst/matroska/matroska-demux.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c index 1fc7e33c6c..fe8e45075c 100644 --- a/gst/matroska/matroska-demux.c +++ b/gst/matroska/matroska-demux.c @@ -2963,6 +2963,8 @@ gst_matroska_demux_subtitle_chunk_has_tag (GstElement * element, { gchar *tag; + g_return_val_if_fail (text != NULL, FALSE); + /* yes, this might all lead to false positives ... */ tag = (gchar *) text; while ((tag = strchr (tag, '<'))) { @@ -3001,7 +3003,7 @@ gst_matroska_demux_check_subtitle_buffer (GstElement * element, sub_stream = (GstMatroskaTrackSubtitleContext *) stream; - if (!gst_buffer_map (*buf, &map, GST_MAP_READ)) + if (!gst_buffer_get_size (*buf) || !gst_buffer_map (*buf, &map, GST_MAP_READ)) return GST_FLOW_OK; if (!sub_stream->invalid_utf8) {