From 8daf6289106662042e7c4211eb0b3a96c46b528f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sat, 24 Sep 2016 10:05:16 -0400 Subject: jpeg2000parse: Don't pass NULL strings to the colorspace / sampling parsing functions They assert on NULL. --- gst/videoparsers/gstjpeg2000parse.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'gst/videoparsers') diff --git a/gst/videoparsers/gstjpeg2000parse.c b/gst/videoparsers/gstjpeg2000parse.c index 13fee2c30..6468bf01d 100644 --- a/gst/videoparsers/gstjpeg2000parse.c +++ b/gst/videoparsers/gstjpeg2000parse.c @@ -188,6 +188,7 @@ gst_jpeg2000_parse_handle_frame (GstBaseParse * parse, guint eoc_offset = 0; GstCaps *current_caps = NULL; GstStructure *current_caps_struct = NULL; + const gchar *colorspace_string = NULL; GstJPEG2000Colorspace colorspace = GST_JPEG2000_COLORSPACE_NONE; guint x0, y0, x1, y1; guint width = 0, height = 0; @@ -196,6 +197,7 @@ gst_jpeg2000_parse_handle_frame (GstBaseParse * parse, guint16 numcomps; guint16 compno; GstJPEG2000Sampling parsed_sampling = GST_JPEG2000_SAMPLING_NONE; + const gchar *sink_sampling_string = NULL; GstJPEG2000Sampling sink_sampling = GST_JPEG2000_SAMPLING_NONE; GstJPEG2000Sampling source_sampling = GST_JPEG2000_SAMPLING_NONE; guint magic_offset = 0; @@ -337,12 +339,14 @@ gst_jpeg2000_parse_handle_frame (GstBaseParse * parse, goto beach; } - colorspace = - gst_jpeg2000_colorspace_from_string (gst_structure_get_string - (current_caps_struct, "colorspace")); - sink_sampling = - gst_jpeg2000_sampling_from_string (gst_structure_get_string - (current_caps_struct, "sampling")); + colorspace_string = gst_structure_get_string + (current_caps_struct, "colorspace"); + if (colorspace_string) + colorspace = gst_jpeg2000_colorspace_from_string (colorspace_string); + sink_sampling_string = gst_structure_get_string + (current_caps_struct, "sampling"); + if (sink_sampling_string) + sink_sampling = gst_jpeg2000_sampling_from_string (sink_sampling_string); for (compno = 0; compno < numcomps; ++compno) { -- cgit v1.2.1