summaryrefslogtreecommitdiff
path: root/apps/metadata.c
diff options
context:
space:
mode:
authorMiika Pekkarinen <miipekk@ihme.org>2006-10-29 20:33:12 +0000
committerMiika Pekkarinen <miipekk@ihme.org>2006-10-29 20:33:12 +0000
commit28918164891e7870f38994e6e053d52d1a39048e (patch)
tree97a46adf71114242f090f95d2caf2535b2b205c4 /apps/metadata.c
parent62a11ea9e67760c812bd95eb7c8408295cd93797 (diff)
downloadrockbox-28918164891e7870f38994e6e053d52d1a39048e.tar.gz
rockbox-28918164891e7870f38994e6e053d52d1a39048e.zip
Fixed division by zero in ogg metadata parser and crash when building
tagcache (FS#6099). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11386 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/metadata.c')
-rw-r--r--apps/metadata.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/apps/metadata.c b/apps/metadata.c
index 9fbf2e19cd..a4d8ef0f64 100644
--- a/apps/metadata.c
+++ b/apps/metadata.c
@@ -760,6 +760,12 @@ static bool get_vorbis_metadata(int fd, struct mp3entry* id3)
760 return false; 760 return false;
761 } 761 }
762 762
763 if (id3->length <= 0)
764 {
765 logf("ogg length invalid!");
766 return false;
767 }
768
763 id3->length = (id3->samples / id3->frequency) * 1000; 769 id3->length = (id3->samples / id3->frequency) * 1000;
764 id3->bitrate = (((int64_t) id3->filesize - comment_size) * 8) / id3->length; 770 id3->bitrate = (((int64_t) id3->filesize - comment_size) * 8) / id3->length;
765 id3->vbr = true; 771 id3->vbr = true;