From: Jan Schmidt Date: Fri, 19 May 2006 14:05:53 +0000 (+0000) Subject: gst/id3demux/id3v2frames.c: Don't output any tag when we encounter a negative track... X-Git-Tag: RELEASE-0_10_5~456 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a4dbbd5d2afcc74454c92fa2dc3958eb951ba3a3;p=platform%2Fupstream%2Fgst-plugins-good.git gst/id3demux/id3v2frames.c: Don't output any tag when we encounter a negative track number - the tag type is uint, so... Original commit message from CVS: * gst/id3demux/id3v2frames.c: (id3v2_tag_to_taglist): Don't output any tag when we encounter a negative track number - the tag type is uint, so we end up outputting huge positive numbers instead. (Fixes: #342029) --- diff --git a/ChangeLog b/ChangeLog index b7cc4cb47..ac5986d20 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-05-19 Jan Schmidt + + * gst/id3demux/id3v2frames.c: (id3v2_tag_to_taglist): + Don't output any tag when we encounter a negative track number - the + tag type is uint, so we end up outputting huge positive numbers + instead. (Fixes: #342029) + 2006-05-19 Thomas Vander Stichele * configure.ac: diff --git a/gst/id3demux/id3v2frames.c b/gst/id3demux/id3v2frames.c index 21ca4f80f..f8c145366 100644 --- a/gst/id3demux/id3v2frames.c +++ b/gst/id3demux/id3v2frames.c @@ -450,41 +450,34 @@ id3v2_tag_to_taglist (ID3TagsWorking * work, const gchar * tag_name, switch (tag_type) { case G_TYPE_UINT: { - guint tmp; - gchar *check; - - tmp = strtoul ((char *) tag_str, &check, 10); - - if (strcmp (tag_name, GST_TAG_TRACK_NUMBER) == 0) { - if (*check == '/') { - guint total; - - check++; - total = strtoul (check, &check, 10); - if (*check != '\0') - break; - - gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND, - GST_TAG_TRACK_COUNT, total, NULL); - } - } else if (strcmp (tag_name, GST_TAG_ALBUM_VOLUME_NUMBER) == 0) { - if (*check == '/') { - guint total; - - check++; - total = strtoul (check, &check, 10); - if (*check != '\0') - break; - - gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND, - GST_TAG_ALBUM_VOLUME_COUNT, total, NULL); + gint current, total; + + if (sscanf (tag_str, "%d/%d", ¤t, &total) == 2) { + if (total < 0) { + GST_WARNING ("Ignoring negative value for total %d in tag %s", + total, tag_name); + } else { + if (strcmp (tag_name, GST_TAG_TRACK_NUMBER) == 0) { + gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND, + GST_TAG_TRACK_COUNT, total, NULL); + } else if (strcmp (tag_name, GST_TAG_ALBUM_VOLUME_NUMBER) == 0) { + gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND, + GST_TAG_ALBUM_VOLUME_COUNT, total, NULL); + } } - } - - if (*check != '\0') + } else if (sscanf (tag_str, "%d", ¤t) != 1) { + /* Not an integer in the string */ + GST_WARNING ("Tag string for tag %s does not contain an integer - " + "ignoring", tag_name); break; + } - gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND, tag_name, tmp, NULL); + if (current < 0) + GST_WARNING ("Ignoring negative value %d in tag %s", current, tag_name); + else { + gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND, tag_name, current, + NULL); + } break; } case G_TYPE_UINT64: