summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2016-09-24 10:05:16 -0400
committerSebastian Dröge <sebastian@centricular.com>2016-09-24 10:05:49 -0400
commit8daf6289106662042e7c4211eb0b3a96c46b528f (patch)
treeb7708a1f86370e3c9e70e5e36fcabad8122ddc2e
parent31d0a2c1eaff8e4824b47bbaa343297563712576 (diff)
downloadgstreamer-plugins-bad-8daf6289106662042e7c4211eb0b3a96c46b528f.tar.gz
jpeg2000parse: Don't pass NULL strings to the colorspace / sampling parsing functions
They assert on NULL.
-rw-r--r--gst/videoparsers/gstjpeg2000parse.c16
1 files changed, 10 insertions, 6 deletions
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) {