From 9589c435164b7e4f4f54e012e59bca4360409560 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Mon, 5 May 2014 14:32:06 +0100 Subject: [PATCH] matroskamux: ensure we don't dereference a NULL pointer while working out the codec ID. Coverity 1195148 --- gst/matroska/matroska-mux.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/gst/matroska/matroska-mux.c b/gst/matroska/matroska-mux.c index 1009bd3..794a0cb 100644 --- a/gst/matroska/matroska-mux.c +++ b/gst/matroska/matroska-mux.c @@ -1022,14 +1022,16 @@ skip_details: gst_matroska_mux_set_codec_id (context, GST_MATROSKA_CODEC_ID_VIDEO_UNCOMPRESSED); fstr = gst_structure_get_string (structure, "format"); - if (fstr && strlen (fstr) == 4) - videocontext->fourcc = GST_STR_FOURCC (fstr); - else if (!strcmp (fstr, "GRAY8")) - videocontext->fourcc = GST_MAKE_FOURCC ('Y', '8', '0', '0'); - else if (!strcmp (fstr, "BGR")) - videocontext->fourcc = GST_MAKE_FOURCC ('B', 'G', 'R', 24); - else if (!strcmp (fstr, "RGB")) - videocontext->fourcc = GST_MAKE_FOURCC ('R', 'G', 'B', 24); + if (fstr) { + if (strlen (fstr) == 4) + videocontext->fourcc = GST_STR_FOURCC (fstr); + else if (!strcmp (fstr, "GRAY8")) + videocontext->fourcc = GST_MAKE_FOURCC ('Y', '8', '0', '0'); + else if (!strcmp (fstr, "BGR")) + videocontext->fourcc = GST_MAKE_FOURCC ('B', 'G', 'R', 24); + else if (!strcmp (fstr, "RGB")) + videocontext->fourcc = GST_MAKE_FOURCC ('R', 'G', 'B', 24); + } } else if (!strcmp (mimetype, "video/x-huffyuv") /* MS/VfW compatibility cases */ ||!strcmp (mimetype, "video/x-divx") || !strcmp (mimetype, "video/x-dv") -- 2.7.4