From d58a4d8804c3b16de38c1e7d85d000dbaa8468a9 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Wed, 30 Apr 2014 11:34:34 +0200 Subject: [PATCH] SampleBuffer: more sanity checks in getSampleFragment() Despite of the previously introduced sanitizing it still sometimes happens that an end frame variable is not greater than the corresponding start frame variable. Make sure we don't crash by adding more sanity checks in getSampleFragment(). Closes #629. --- src/core/SampleBuffer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/SampleBuffer.cpp b/src/core/SampleBuffer.cpp index a291ddbc5..75558364d 100644 --- a/src/core/SampleBuffer.cpp +++ b/src/core/SampleBuffer.cpp @@ -752,14 +752,14 @@ sampleFrame * SampleBuffer::getSampleFragment( f_cnt_t _start, { if( _looped ) { - if( _start + _frames <= m_loopEndFrame ) + if( _start + _frames <= m_loopEndFrame || m_loopStartFrame >= m_loopEndFrame ) { return m_data + _start; } } else { - if( _start + _frames <= m_endFrame ) + if( _start + _frames <= m_endFrame || m_startFrame >= m_endFrame ) { return m_data + _start; }