diff options
author | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2012-12-18 15:43:37 +0100 |
---|---|---|
committer | Sebastian Dröge <slomo@circular-chaos.org> | 2013-07-29 12:30:23 +0200 |
commit | 5d107a693fcce80a0d77523b883706829a186e6a (patch) | |
tree | f26b59d2502296775f8884e4c677b51c04181201 | |
parent | eb9c88700b1d5ac9971b98d5be0e668965cee756 (diff) | |
download | gstreamer-plugins-bad-5d107a693fcce80a0d77523b883706829a186e6a.tar.gz |
openjpegdec: Don't crash if colorspace is not provided on the caps
g_str_equal() is *not* NULL-safe
-rw-r--r-- | ext/openjpeg/gstopenjpegdec.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/ext/openjpeg/gstopenjpegdec.c b/ext/openjpeg/gstopenjpegdec.c index 33fdf1df5..d027e960a 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); |