diff data/fileio/CodedAudioFileReader.cpp @ 1282:56c06dc0937c 3.0-integration

Avoid potentially trying to allocate negative-sized vector!
author Chris Cannam
date Wed, 23 Nov 2016 10:35:10 +0000
parents 0a9193dc136b
children 757a406dabc4 4704e834d0f9
line wrap: on
line diff
--- a/data/fileio/CodedAudioFileReader.cpp	Wed Nov 23 10:34:45 2016 +0000
+++ b/data/fileio/CodedAudioFileReader.cpp	Wed Nov 23 10:35:10 2016 +0000
@@ -480,9 +480,11 @@
         // really have threads taking a long time to read concurrently
         m_dataLock.lock();
         sv_frame_t n = sv_frame_t(m_data.size());
+        if (ix0 > n) ix0 = n;
         if (ix1 > n) ix1 = n;
         frames = vector<float>(m_data.begin() + ix0, m_data.begin() + ix1);
         m_dataLock.unlock();
+        break;
     }
     }