From da8f8270c3a1ef5474bc0fe0a77b5ff5894a40ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 18 Dec 2012 15:43:37 +0100 Subject: [PATCH] openjpegdec: Don't crash if colorspace is not provided on the caps g_str_equal() is *not* NULL-safe --- ext/openjpeg/gstopenjpegdec.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/ext/openjpeg/gstopenjpegdec.c b/ext/openjpeg/gstopenjpegdec.c index 33fdf1df5e..d027e960a9 100644 --- a/ext/openjpeg/gstopenjpegdec.c +++ b/ext/openjpeg/gstopenjpegdec.c @@ -171,13 +171,14 @@ gst_openjpeg_dec_set_format (GstVideoDecoder * decoder, g_return_val_if_reached (FALSE); } - color_space = gst_structure_get_string (s, "colorspace"); - if (g_str_equal (color_space, "sRGB")) - self->color_space = CLRSPC_SRGB; - else if (g_str_equal (color_space, "GRAY")) - self->color_space = CLRSPC_GRAY; - else if (g_str_equal (color_space, "sYUV")) - self->color_space = CLRSPC_SYCC; + if ((color_space = gst_structure_get_string (s, "colorspace"))) { + if (g_str_equal (color_space, "sRGB")) + self->color_space = CLRSPC_SRGB; + else if (g_str_equal (color_space, "GRAY")) + self->color_space = CLRSPC_GRAY; + else if (g_str_equal (color_space, "sYUV")) + self->color_space = CLRSPC_SYCC; + } self->ncomps = 0; gst_structure_get_int (s, "num-components", &self->ncomps);