From c64021f87d770e1e1ad8e62dd3be308bf05e7c53 Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Sat, 18 Feb 2006 20:48:09 +0000 Subject: [PATCH] gst/id3demux/: Handle 0 data size in otherwise valid frames. Original commit message from CVS: * gst/id3demux/id3tags.c: (id3demux_id3v2_frames_to_tag_list): * gst/id3demux/id3v2frames.c: (id3v2_genre_fields_to_taglist): Handle 0 data size in otherwise valid frames. Handle numeric strings in 2.4.0 even when not in parentheses --- ChangeLog | 7 +++++++ gst/id3demux/id3tags.c | 6 ++++-- gst/id3demux/id3v2frames.c | 4 +++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 60aa63ec4d..89596cc753 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-02-18 Jan Schmidt + + * gst/id3demux/id3tags.c: (id3demux_id3v2_frames_to_tag_list): + * gst/id3demux/id3v2frames.c: (id3v2_genre_fields_to_taglist): + Handle 0 data size in otherwise valid frames. + Handle numeric strings in 2.4.0 even when not in parentheses + 2006-02-18 Tim-Philipp Müller * gst/matroska/matroska-demux.c: diff --git a/gst/id3demux/id3tags.c b/gst/id3demux/id3tags.c index 2ce23e0db8..157d601d9e 100644 --- a/gst/id3demux/id3tags.c +++ b/gst/id3demux/id3tags.c @@ -333,6 +333,7 @@ id3demux_id3v2_frames_to_tag_list (ID3TagsWorking * work, guint size) work->hdr.ext_hdr_size = read_synch_uint (work->hdr.frame_data, 4); if (work->hdr.ext_hdr_size < 6 || (work->hdr.ext_hdr_size) > work->hdr.frame_data_size) { + GST_DEBUG ("Invalid extended header. Broken tag"); return ID3TAGS_BROKEN_TAG; } work->hdr.ext_flag_bytes = work->hdr.frame_data[4]; @@ -400,6 +401,8 @@ id3demux_id3v2_frames_to_tag_list (ID3TagsWorking * work, guint size) if (ID3V2_VER_MAJOR (work->hdr.version) == 3) { frame_flags &= ID3V2_3_FRAME_FLAGS_MASK; obsolete_id = convert_fid_to_v240 (frame_id); + if (obsolete_id) + GST_DEBUG ("Ignoring v2.3 frame %s", frame_id); } break; } @@ -407,8 +410,7 @@ id3demux_id3v2_frames_to_tag_list (ID3TagsWorking * work, guint size) work->hdr.frame_data += frame_hdr_size; work->hdr.frame_data_size -= frame_hdr_size; - if (frame_size > work->hdr.frame_data_size || - frame_size == 0 || strcmp (frame_id, "") == 0) + if (frame_size > work->hdr.frame_data_size || strcmp (frame_id, "") == 0) break; /* No more frames to read */ #if 1 diff --git a/gst/id3demux/id3v2frames.c b/gst/id3demux/id3v2frames.c index cf356433c8..bab609ded7 100644 --- a/gst/id3demux/id3v2frames.c +++ b/gst/id3demux/id3v2frames.c @@ -420,7 +420,9 @@ id3v2_genre_fields_to_taglist (ID3TagsWorking * work, const gchar * tag_name, continue; len = strlen (tag_str); - if (work->hdr.version <= 0x300) { /* <= 2.3.0 */ + /* Only supposed to see '(n)' type numeric genre strings in ID3 <= 2.3.0 + * but apparently we see them in 2.4.0 sometimes too */ + if (TRUE || work->hdr.version <= 0x300) { /* <= 2.3.0 */ /* Check for genre numbers wrapped in parentheses, possibly * followed by a string */ while (len >= 2) {