summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-10-29 10:29:57 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-10-29 10:29:57 +0000
commitfd3d50a4db38758b880908e6eb5a8601d2c10a9c (patch)
treeb1d3902f9a3517dd0264224cd0e89103588c14de
parent18225f6a98ca0e90991de4bb6d3f7ef6da0471ff (diff)
downloadrockbox-fd3d50a4db38758b880908e6eb5a8601d2c10a9c.zip
rockbox-fd3d50a4db38758b880908e6eb5a8601d2c10a9c.tar.gz
rockbox-fd3d50a4db38758b880908e6eb5a8601d2c10a9c.tar.bz2
rockbox-fd3d50a4db38758b880908e6eb5a8601d2c10a9c.tar.xz
Better handling of large frames in V2 tags
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2771 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/id3.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/firmware/id3.c b/firmware/id3.c
index e59618e..f09ccf4 100644
--- a/firmware/id3.c
+++ b/firmware/id3.c
@@ -223,7 +223,7 @@ static bool setid3v1title(int fd, struct mp3entry *entry)
/*
* Sets the title of an MP3 entry based on its ID3v2 tag.
*
- * Arguments: file - the MP3 file to scen for a ID3v2 tag
+ * Arguments: file - the MP3 file to scan for a ID3v2 tag
* entry - the entry to set the title in
*
* Returns: true if a title was found and created, else false
@@ -291,7 +291,7 @@ static void setid3v2title(int fd, struct mp3entry *entry)
}
/* Keep track of the total size */
- totframelen += framelen;
+ totframelen = framelen;
if(framelen == 0)
return;
@@ -300,7 +300,7 @@ static void setid3v2title(int fd, struct mp3entry *entry)
to read as much as would fit in the buffer */
if(framelen >= buffersize - bufferpos)
framelen = buffersize - bufferpos - 1;
-
+
/* Check for certain frame headers */
if(!strncmp(header, "TPE1", strlen("TPE1")) ||
!strncmp(header, "TP1", strlen("TP1"))) {
@@ -337,6 +337,12 @@ static void setid3v2title(int fd, struct mp3entry *entry)
bufferpos += bytesread + 1;
size -= bytesread;
}
+ else {
+ /* Unknown frame, skip it using the total size in case
+ it was truncated */
+ size -= totframelen;
+ lseek(fd, totframelen, SEEK_CUR);
+ }
}
}