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
This commit is contained in:
Miika Pekkarinen 2006-10-29 20:33:12 +00:00
parent 62a11ea9e6
commit 2891816489

View file

@ -760,6 +760,12 @@ static bool get_vorbis_metadata(int fd, struct mp3entry* id3)
return false; return false;
} }
if (id3->length <= 0)
{
logf("ogg length invalid!");
return false;
}
id3->length = (id3->samples / id3->frequency) * 1000; id3->length = (id3->samples / id3->frequency) * 1000;
id3->bitrate = (((int64_t) id3->filesize - comment_size) * 8) / id3->length; id3->bitrate = (((int64_t) id3->filesize - comment_size) * 8) / id3->length;
id3->vbr = true; id3->vbr = true;