mirror of
https://github.com/taglib/taglib.git
synced 2025-06-04 01:28:21 -04:00
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)
This commit is contained in:
parent
843070ba18
commit
a41b32bbb2
@ -156,5 +156,5 @@ void RIFF::AIFF::Properties::read(const ByteVector &data)
|
||||
double sampleRate = ConvertFromIeeeExtended(reinterpret_cast<unsigned char *>(data.mid(8, 10).data()));
|
||||
d->sampleRate = sampleRate;
|
||||
d->bitrate = (sampleRate * d->sampleWidth * d->channels) / 1000.0;
|
||||
d->length = d->sampleFrames / d->sampleRate;
|
||||
d->length = d->sampleRate > 0 ? d->sampleFrames / d->sampleRate : 0;
|
||||
}
|
||||
|
@ -124,5 +124,6 @@ void RIFF::WAV::Properties::read(const ByteVector &data)
|
||||
d->bitrate = byteRate * 8 / 1000;
|
||||
|
||||
d->length = byteRate > 0 ? d->streamLength / byteRate : 0;
|
||||
d->sampleFrames = d->streamLength / (d->channels * (d->sampleWidth / 8));
|
||||
if(d->channels > 0 && d->sampleWidth > 0)
|
||||
d->sampleFrames = d->streamLength / (d->channels * (d->sampleWidth / 8));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user