From 123671bc05060ac3f713c097d205d8122a1cc299 Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Sun, 9 Oct 2011 14:21:28 -0300 Subject: [PATCH] libs: video: Add protection against null strings Check and assert if input for gst_video_format_from_string is null. Return GST_VIDEO_FORMAT_UNKNOWN as a fallback --- gst-libs/gst/video/video.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gst-libs/gst/video/video.c b/gst-libs/gst/video/video.c index 130c980e79..13af59299c 100644 --- a/gst-libs/gst/video/video.c +++ b/gst-libs/gst/video/video.c @@ -535,6 +535,8 @@ gst_video_format_from_string (const gchar * format) { guint i; + g_return_val_if_fail (format != NULL, GST_VIDEO_FORMAT_UNKNOWN); + for (i = 0; i < G_N_ELEMENTS (formats); i++) { if (strcmp (GST_VIDEO_FORMAT_INFO_NAME (&formats[i].info), format) == 0) return GST_VIDEO_FORMAT_INFO_FORMAT (&formats[i].info);