From 0e43079d061a4fde133aa4682a6c552552821ff0 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Tue, 29 Dec 2015 12:07:55 -0500 Subject: [PATCH] Further precautions for the corrupt .wav bug... Check both allocations of buffers. See commit 407c1dc4b209111e4dbb3eec88f333aa8f69094c --- src/import/ImportPCM.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/import/ImportPCM.cpp b/src/import/ImportPCM.cpp index d8eef3273..d4f6eb0cb 100644 --- a/src/import/ImportPCM.cpp +++ b/src/import/ImportPCM.cpp @@ -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;