From: Arun Raghavan Date: Fri, 24 May 2019 13:22:58 +0000 (+0200) Subject: video-color: Deal with NULL colorimetry while converting from string X-Git-Tag: accepted/tizen/unified/20220217.153506~2^2~10^2~9^2~16^2~1^2~42^2~1^2~38 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e47b01f3c7d4abc43fa2afa718e0f05f5f5a5298;p=platform%2Fupstream%2Fgstreamer.git 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. --- 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 {