From 8cf0d5a65ce672f897feca20517bafa08c86dd17 Mon Sep 17 00:00:00 2001 From: James Cowgill Date: Tue, 22 Oct 2024 13:23:05 +0100 Subject: [PATCH] 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: --- .../gst-plugins-base/gst-libs/gst/tag/gstexiftag.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/subprojects/gst-plugins-base/gst-libs/gst/tag/gstexiftag.c b/subprojects/gst-plugins-base/gst-libs/gst/tag/gstexiftag.c index 55753e570e..d91686a9d0 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/tag/gstexiftag.c +++ b/subprojects/gst-plugins-base/gst-libs/gst/tag/gstexiftag.c @@ -1322,9 +1322,13 @@ parse_exif_ascii_tag (GstExifReader * reader, const GstExifTagMatch * tag, GstDateTime *d; d = gst_date_time_new_local_time (year, month, day, hour, minute, second); - gst_tag_list_add (reader->taglist, GST_TAG_MERGE_REPLACE, - tag->gst_tag, d, NULL); - gst_date_time_unref (d); + if (d) { + gst_tag_list_add (reader->taglist, GST_TAG_MERGE_REPLACE, + tag->gst_tag, d, NULL); + gst_date_time_unref (d); + } else { + GST_WARNING ("Failed to parse %s into a datetime tag", utfstr); + } } else { GST_WARNING ("Failed to parse %s into a datetime tag", utfstr); }