From e47b01f3c7d4abc43fa2afa718e0f05f5f5a5298 Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Fri, 24 May 2019 15:22:58 +0200 Subject: [PATCH] video-color: Deal with NULL colorimetry while converting from string This came up in the case where v4l2 sets caps with colorimetry=NULL, and then tries to parse back the colorimetry, causing a crash in gst_video_get_colorimetry() because of g_str_equal(). We fix this by making sure the only caller of the function never calls it with a null colorimetry string. --- gst-libs/gst/video/video-color.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/video/video-color.c b/gst-libs/gst/video/video-color.c index ec3dddc..04d8aeb 100644 --- a/gst-libs/gst/video/video-color.c +++ b/gst-libs/gst/video/video-color.c @@ -119,7 +119,10 @@ gst_video_colorimetry_from_string (GstVideoColorimetry * cinfo, const ColorimetryInfo *ci; gboolean res = FALSE; - if ((ci = gst_video_get_colorimetry (color))) { + if (!color) { + *cinfo = colorimetry[DEFAULT_UNKNOWN].color; + res = TRUE; + } else if ((ci = gst_video_get_colorimetry (color))) { *cinfo = ci->color; res = TRUE; } else { -- 2.7.4