From 294cb222414292a03a5dd69931d365f53a0356cf Mon Sep 17 00:00:00 2001 From: "Stephen F. Booth" Date: Thu, 28 Jul 2011 08:36:14 -0400 Subject: [PATCH] Don't crash when wav files have a 0 for bit per channel (sampleWidth) I've seen this in a wav that has an audio format of MP3 (0x55) --- taglib/riff/aiff/aiffproperties.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/taglib/riff/aiff/aiffproperties.cpp b/taglib/riff/aiff/aiffproperties.cpp index 77c3d277..afb741b7 100644 --- a/taglib/riff/aiff/aiffproperties.cpp +++ b/taglib/riff/aiff/aiffproperties.cpp @@ -149,5 +149,5 @@ void RIFF::AIFF::Properties::read(const ByteVector &data) double sampleRate = ConvertFromIeeeExtended(reinterpret_cast(data.mid(8, 10).data())); d->sampleRate = sampleRate; d->bitrate = (sampleRate * d->sampleWidth * d->channels) / 1000.0; - d->length = sampleFrames / d->sampleRate; + d->length = d->sampleRate > 0 ? sampleFrames / d->sampleRate : 0; }