exiftag: Check the result of gst_date_time_new_local_time

Fixes a critical warning when parsing a JPEG containing a malformed
`DateTime` tag (like `0000:00:00 00:00:00`).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7709>
This commit is contained in:
James Cowgill 2024-10-22 13:23:05 +01:00 committed by GStreamer Marge Bot
parent 703cc1783e
commit 8cf0d5a65c

View file

@ -1322,12 +1322,16 @@ parse_exif_ascii_tag (GstExifReader * reader, const GstExifTagMatch * tag,
GstDateTime *d; GstDateTime *d;
d = gst_date_time_new_local_time (year, month, day, hour, minute, second); d = gst_date_time_new_local_time (year, month, day, hour, minute, second);
if (d) {
gst_tag_list_add (reader->taglist, GST_TAG_MERGE_REPLACE, gst_tag_list_add (reader->taglist, GST_TAG_MERGE_REPLACE,
tag->gst_tag, d, NULL); tag->gst_tag, d, NULL);
gst_date_time_unref (d); gst_date_time_unref (d);
} else { } else {
GST_WARNING ("Failed to parse %s into a datetime tag", utfstr); GST_WARNING ("Failed to parse %s into a datetime tag", utfstr);
} }
} else {
GST_WARNING ("Failed to parse %s into a datetime tag", utfstr);
}
} else if (tagtype == G_TYPE_STRING) { } else if (tagtype == G_TYPE_STRING) {
if (utfstr[0] != '\0') if (utfstr[0] != '\0')
gst_tag_list_add (reader->taglist, GST_TAG_MERGE_REPLACE, tag->gst_tag, gst_tag_list_add (reader->taglist, GST_TAG_MERGE_REPLACE, tag->gst_tag,