Skip to content

Commit

Permalink
Fix read before m_bufferInt during scratching
Browse files Browse the repository at this point in the history
  • Loading branch information
daschuer committed Nov 22, 2024
1 parent 8376703 commit 26c0c8a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/engine/bufferscalers/enginebufferscalelinear.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,12 @@ double EngineBufferScaleLinear::scaleBuffer(
// reset m_floorSampleOld in a way as we were coming from
// the other direction
SINT iNextSample = getOutputSignal().frames2samples(static_cast<SINT>(ceil(m_dNextFrame)));
if (iNextSample + 1 < m_bufferIntSize) {
if (iNextSample >= 0 && iNextSample + 1 < m_bufferIntSize) {
m_floorSampleOld[0] = m_bufferInt[iNextSample];
m_floorSampleOld[1] = m_bufferInt[iNextSample + 1];
} else {
m_floorSampleOld[0] = CSAMPLE_ZERO;
m_floorSampleOld[1] = CSAMPLE_ZERO;
}

// if the buffer has extra samples, do a read so RAMAN ends up back where
Expand Down

0 comments on commit 26c0c8a

Please sign in to comment.