From 436901a86b8698b8d48a7f2ed87a9afbf7057a47 Mon Sep 17 00:00:00 2001 From: Magnus Holmgren Date: Thu, 11 Aug 2005 19:59:47 +0000 Subject: [PATCH] Only check for frames with three-letter names when parsing ID3V2.2 tags (and only check four-letter names when parsing ID3V2.3+ tags). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7306 a1c6a512-1295-4272-9138-f99709370657 --- firmware/id3.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/firmware/id3.c b/firmware/id3.c index d783053426..c59c9c12a0 100644 --- a/firmware/id3.c +++ b/firmware/id3.c @@ -738,6 +738,18 @@ static void setid3v2title(int fd, struct mp3entry *entry) : NULL; char* tag; + /* Only ID3_VER_2_2 uses frames with three-character names. */ + if (((version == ID3_VER_2_2) && (tr->tag_length != 3)) + || ((version > ID3_VER_2_2) && (tr->tag_length != 4))) { + continue; + } + + /* Note that parser functions sometimes set *ptag to NULL, so + * the "!*ptag" check here doesn't always have the desired + * effect. Should the parser functions (parsegenre in + * particular) be updated to handle the case of being called + * multiple times, or should the "*ptag" check be removed? + */ if( (!ptag || !*ptag) && !memcmp( header, tr->tag, tr->tag_length ) ) { /* found a tag matching one in tagList, and not yet filled */