1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-17 09:07:41 +02:00

Further precautions for the corrupt .wav bug...

Check both allocations of buffers.

See commit 407c1dc4b209111e4dbb3eec88f333aa8f69094c
This commit is contained in:
Paul Licameli 2015-12-29 12:07:55 -05:00 committed by Paul Licameli
parent 2c0cdda353
commit 0e43079d06

View File

@ -451,17 +451,16 @@ ProgressResult PCMImportFileHandle::Import(TrackFactory *trackFactory,
if (maxBlock < 1)
return ProgressResult::Failed;
SampleBuffer srcbuffer;
SampleBuffer srcbuffer, buffer;
wxASSERT(mInfo.channels >= 0);
while (NULL == srcbuffer.Allocate(maxBlock * mInfo.channels, mFormat).ptr())
while (NULL == srcbuffer.Allocate(maxBlock * mInfo.channels, mFormat).ptr() ||
NULL == buffer.Allocate(maxBlock, mFormat).ptr())
{
maxBlock /= 2;
if (maxBlock < 1)
return ProgressResult::Failed;
}
SampleBuffer buffer(maxBlock, mFormat);
decltype(fileTotalFrames) framescompleted = 0;
long block;