From cd00206059a398ea889621ea284642e2208a56e1 Mon Sep 17 00:00:00 2001 From: Marcin Lewandowski Date: Fri, 5 Jul 2013 00:47:08 +0100 Subject: [PATCH] tag: ignore malformed ID3v2 TDAT frames Just skip them, don't cause criticals. https://bugzilla.gnome.org/show_bug.cgi?id=703283 --- gst-libs/gst/tag/id3v2frames.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/gst-libs/gst/tag/id3v2frames.c b/gst-libs/gst/tag/id3v2frames.c index f9ba2220a2..3785c2a5c2 100644 --- a/gst-libs/gst/tag/id3v2frames.c +++ b/gst-libs/gst/tag/id3v2frames.c @@ -695,11 +695,21 @@ parse_obsolete_tdat_frame (ID3TagsWorking * work) g_ascii_isdigit (work->parse_data[2]) && g_ascii_isdigit (work->parse_data[3]) && g_ascii_isdigit (work->parse_data[4])) { - work->pending_day = (10 * g_ascii_digit_value (work->parse_data[1])) + + + guint pending_day = (10 * g_ascii_digit_value (work->parse_data[1])) + g_ascii_digit_value (work->parse_data[2]); - work->pending_month = (10 * g_ascii_digit_value (work->parse_data[3])) + + guint pending_month = (10 * g_ascii_digit_value (work->parse_data[3])) + g_ascii_digit_value (work->parse_data[4]); - GST_LOG ("date (dd/mm) %02u/%02u", work->pending_day, work->pending_month); + + if (pending_day >= 1 && pending_day <= 31 && pending_month >= 1 + && pending_month <= 12) { + GST_LOG ("date (dd/mm) %02u/%02u", pending_day, pending_month); + work->pending_day = pending_day; + work->pending_month = pending_month; + } else { + GST_WARNING ("Ignoring invalid ID3v2 TDAT frame (dd/mm) %02u/%02u", + pending_day, pending_month); + } } }