Bug 1033066: Never let AudioSegments underflow mDuration and cause OOM allocation r=karlt

This commit is contained in:
Randell Jesup 2014-09-26 14:13:17 -04:00
parent 91f039742d
commit 4722e9943c
2 changed files with 4 additions and 3 deletions

View File

@ -154,7 +154,8 @@ AudioSegment::WriteTo(uint64_t aID, AudioMixer& aMixer, uint32_t aOutputChannels
// Offset in the buffer that will end up sent to the AudioStream, in samples.
uint32_t offset = 0;
if (!GetDuration()) {
if (GetDuration() <= 0) {
MOZ_ASSERT(GetDuration() == 0);
return;
}

View File

@ -86,8 +86,8 @@ struct AudioChunk {
// Generic methods
void SliceTo(TrackTicks aStart, TrackTicks aEnd)
{
NS_ASSERTION(aStart >= 0 && aStart < aEnd && aEnd <= mDuration,
"Slice out of bounds");
MOZ_ASSERT(aStart >= 0 && aStart < aEnd && aEnd <= mDuration,
"Slice out of bounds");
if (mBuffer) {
MOZ_ASSERT(aStart < INT32_MAX, "Can't slice beyond 32-bit sample lengths");
for (uint32_t channel = 0; channel < mChannelData.Length(); ++channel) {