Skip to content

Commit

Permalink
SampleBuffer: more sanity checks in getSampleFragment()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tobydox committed Apr 30, 2014
1 parent 09fb597 commit d58a4d8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/SampleBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit d58a4d8

Please sign in to comment.