C4FM: bounds check the start of the buffer in the sync score (#2622)

A lagging sync detect on the first symbol after a buffer reload, followed by a
coarse timing search that steps all the way left, scores a candidate whose first
sync symbol is one sample before the buffer start. score() only checked the end
of the buffer, so it threw ArrayIndexOutOfBoundsException: Index -1.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Steve Pinkham
2026-11-11 03:22:44 -05:00
committed by GitHub
parent 000ac51ff0
commit e7f4f655e5
2 changed files with 51 additions and 1 deletions

View File

@@ -1313,7 +1313,7 @@ public abstract class C4FMSymbolProcessor
for(int x = 0; x < patternSymbols.length; x++)
{
if(bufferPointer < maxPointer)
if(bufferPointer >= 0 && bufferPointer < maxPointer)
{
softSymbol = interpolate(mBuffer[bufferPointer], mBuffer[bufferPointer + 1], fractional) * gain + balance;
}