summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2013-04-26 22:34:59 +0200
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2013-04-26 22:45:04 +0200
commit370ed6de7c7596b2a1f6a2f99c8070bd179b4abd (patch)
treeb043b40a39a09362ae4c02201c7555327dd15972
parent1489fa3a1576586997a3bb392d383af8c91d1777 (diff)
downloadrockbox-370ed6de7c7596b2a1f6a2f99c8070bd179b4abd.tar.gz
rockbox-370ed6de7c7596b2a1f6a2f99c8070bd179b4abd.tar.bz2
rockbox-370ed6de7c7596b2a1f6a2f99c8070bd179b4abd.zip
Properly seek to next id3v2 frame for unsynced tags.
When seeking to the next id3v2 frame we need to consider if the tag has the unsync flag set. Not doing so will likely make parsing end up in the middle of the current frame if the frame size exceeds the upper limit set during read. The latter usually happens for album art frames. Fixes FS#12849. Change-Id: Ic92853eef4374508d84df347bcc66b6661d5037d
-rw-r--r--lib/rbcodec/metadata/id3tags.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/rbcodec/metadata/id3tags.c b/lib/rbcodec/metadata/id3tags.c
index 3d1d7e4d71..e7fed7c868 100644
--- a/lib/rbcodec/metadata/id3tags.c
+++ b/lib/rbcodec/metadata/id3tags.c
@@ -967,7 +967,7 @@ void setid3v2title(int fd, struct mp3entry *entry)
* language string and an optional short description;
* remove them so unicode_munge can work correctly
*/
-
+
if((tr->tag_length == 4 && !memcmp( header, "COMM", 4)) ||
(tr->tag_length == 3 && !memcmp( header, "COM", 3))) {
int offset;
@@ -1113,8 +1113,15 @@ void setid3v2title(int fd, struct mp3entry *entry)
}
} else {
/* Seek to the next frame */
- if(framelen < totframelen)
- lseek(fd, totframelen - framelen, SEEK_CUR);
+ if(framelen < totframelen) {
+ if(global_unsynch && version <= ID3_VER_2_3) {
+ size -= skip_unsynched(fd, totframelen - framelen);
+ }
+ else {
+ lseek(fd, totframelen - framelen, SEEK_CUR);
+ size -= totframelen - framelen;
+ }
+ }
}
}
}