summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2004-03-30 13:57:06 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2004-03-30 13:57:06 +0000
commit2cc373eb9967c130b658dfdb1e64a8ed67f6c306 (patch)
treee5907c26785d4f5a34fced8ad9438d9e76dd9bbd
parente2ee28cd537c7f8202b1e3fa16753522957dc41d (diff)
downloadrockbox-2cc373eb9967c130b658dfdb1e64a8ed67f6c306.tar.gz
rockbox-2cc373eb9967c130b658dfdb1e64a8ed67f6c306.zip
The ID3 parser accidentally allowed a data length indicator flag on 2.3 tags, and the grouping identity bit is not the same on 2.3 and 2.4 (sigh).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4455 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/id3.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/firmware/id3.c b/firmware/id3.c
index 1d0172cf35..131eeda82a 100644
--- a/firmware/id3.c
+++ b/firmware/id3.c
@@ -16,7 +16,6 @@
* KIND, either express or implied.
*
****************************************************************************/
-
/*
* Parts of this code has been stolen from the Ample project and was written
* by David Härdeman. It has since been extended and enhanced pretty much by
@@ -552,9 +551,16 @@ static void setid3v2title(int fd, struct mp3entry *entry)
{
skip = 0;
- if(flags & 0x0040) { /* Grouping identity */
- lseek(fd, 1, SEEK_CUR); /* Skip 1 byte */
- framelen--;
+ if (version >= ID3_VER_2_4) {
+ if(flags & 0x0040) { /* Grouping identity */
+ lseek(fd, 1, SEEK_CUR); /* Skip 1 byte */
+ framelen--;
+ }
+ } else {
+ if(flags & 0x0020) { /* Grouping identity */
+ lseek(fd, 1, SEEK_CUR); /* Skip 1 byte */
+ framelen--;
+ }
}
if(flags & 0x000c) /* Compression or encryption */
@@ -569,12 +575,14 @@ static void setid3v2title(int fd, struct mp3entry *entry)
if(flags & 0x0002) /* Unsynchronization */
unsynch = true;
- if(flags & 0x0001) { /* Data length indicator */
- if(4 != read(fd, tmp, 4))
- return;
+ if (version >= ID3_VER_2_4) {
+ if(flags & 0x0001) { /* Data length indicator */
+ if(4 != read(fd, tmp, 4))
+ return;
- data_length_ind = UNSYNC(tmp[0], tmp[1], tmp[2], tmp[3]);
- framelen -= 4;
+ data_length_ind = UNSYNC(tmp[0], tmp[1], tmp[2], tmp[3]);
+ framelen -= 4;
+ }
}
}