diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/id3.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/firmware/id3.c b/firmware/id3.c index e59618e234..f09ccf4ab2 100644 --- a/firmware/id3.c +++ b/firmware/id3.c | |||
@@ -223,7 +223,7 @@ static bool setid3v1title(int fd, struct mp3entry *entry) | |||
223 | /* | 223 | /* |
224 | * Sets the title of an MP3 entry based on its ID3v2 tag. | 224 | * Sets the title of an MP3 entry based on its ID3v2 tag. |
225 | * | 225 | * |
226 | * Arguments: file - the MP3 file to scen for a ID3v2 tag | 226 | * Arguments: file - the MP3 file to scan for a ID3v2 tag |
227 | * entry - the entry to set the title in | 227 | * entry - the entry to set the title in |
228 | * | 228 | * |
229 | * Returns: true if a title was found and created, else false | 229 | * Returns: true if a title was found and created, else false |
@@ -291,7 +291,7 @@ static void setid3v2title(int fd, struct mp3entry *entry) | |||
291 | } | 291 | } |
292 | 292 | ||
293 | /* Keep track of the total size */ | 293 | /* Keep track of the total size */ |
294 | totframelen += framelen; | 294 | totframelen = framelen; |
295 | 295 | ||
296 | if(framelen == 0) | 296 | if(framelen == 0) |
297 | return; | 297 | return; |
@@ -300,7 +300,7 @@ static void setid3v2title(int fd, struct mp3entry *entry) | |||
300 | to read as much as would fit in the buffer */ | 300 | to read as much as would fit in the buffer */ |
301 | if(framelen >= buffersize - bufferpos) | 301 | if(framelen >= buffersize - bufferpos) |
302 | framelen = buffersize - bufferpos - 1; | 302 | framelen = buffersize - bufferpos - 1; |
303 | 303 | ||
304 | /* Check for certain frame headers */ | 304 | /* Check for certain frame headers */ |
305 | if(!strncmp(header, "TPE1", strlen("TPE1")) || | 305 | if(!strncmp(header, "TPE1", strlen("TPE1")) || |
306 | !strncmp(header, "TP1", strlen("TP1"))) { | 306 | !strncmp(header, "TP1", strlen("TP1"))) { |
@@ -337,6 +337,12 @@ static void setid3v2title(int fd, struct mp3entry *entry) | |||
337 | bufferpos += bytesread + 1; | 337 | bufferpos += bytesread + 1; |
338 | size -= bytesread; | 338 | size -= bytesread; |
339 | } | 339 | } |
340 | else { | ||
341 | /* Unknown frame, skip it using the total size in case | ||
342 | it was truncated */ | ||
343 | size -= totframelen; | ||
344 | lseek(fd, totframelen, SEEK_CUR); | ||
345 | } | ||
340 | } | 346 | } |
341 | } | 347 | } |
342 | 348 | ||