diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2013-04-26 22:34:59 +0200 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2013-04-26 22:45:04 +0200 |
commit | 370ed6de7c7596b2a1f6a2f99c8070bd179b4abd (patch) | |
tree | b043b40a39a09362ae4c02201c7555327dd15972 | |
parent | 1489fa3a1576586997a3bb392d383af8c91d1777 (diff) | |
download | rockbox-370ed6de7c7596b2a1f6a2f99c8070bd179b4abd.tar.gz 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.c | 13 |
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) | |||
967 | * language string and an optional short description; | 967 | * language string and an optional short description; |
968 | * remove them so unicode_munge can work correctly | 968 | * remove them so unicode_munge can work correctly |
969 | */ | 969 | */ |
970 | 970 | ||
971 | if((tr->tag_length == 4 && !memcmp( header, "COMM", 4)) || | 971 | if((tr->tag_length == 4 && !memcmp( header, "COMM", 4)) || |
972 | (tr->tag_length == 3 && !memcmp( header, "COM", 3))) { | 972 | (tr->tag_length == 3 && !memcmp( header, "COM", 3))) { |
973 | int offset; | 973 | int offset; |
@@ -1113,8 +1113,15 @@ void setid3v2title(int fd, struct mp3entry *entry) | |||
1113 | } | 1113 | } |
1114 | } else { | 1114 | } else { |
1115 | /* Seek to the next frame */ | 1115 | /* Seek to the next frame */ |
1116 | if(framelen < totframelen) | 1116 | if(framelen < totframelen) { |
1117 | lseek(fd, totframelen - framelen, SEEK_CUR); | 1117 | if(global_unsynch && version <= ID3_VER_2_3) { |
1118 | size -= skip_unsynched(fd, totframelen - framelen); | ||
1119 | } | ||
1120 | else { | ||
1121 | lseek(fd, totframelen - framelen, SEEK_CUR); | ||
1122 | size -= totframelen - framelen; | ||
1123 | } | ||
1124 | } | ||
1118 | } | 1125 | } |
1119 | } | 1126 | } |
1120 | } | 1127 | } |