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.
This commit is contained in:
Arun Raghavan 2019-05-24 15:22:58 +02:00
parent aa759d4204
commit 326940f89a

View file

@ -118,7 +118,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 {