Skip to content

Commit

Permalink
Fixed possible AOOBE when averaging the analog signal.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Willem Janssen committed Feb 24, 2012
1 parent 4fd128d commit 234f8b3
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -608,8 +608,10 @@ private void paintSignals( final Graphics2D aCanvas, final SignalViewModel aMode
for ( int sampleIdx = startIdx; sampleIdx < endIdx; sampleIdx += sampleIncr )
{
long timestamp = timestamps[sampleIdx];

int sampleValue = 0;
for ( int i = sampleIdx + 1; i < ( ( sampleIdx + sampleIncr ) - 1 ); i++ )
final int i_max = Math.min( endIdx, ( sampleIdx + sampleIncr ) - 1 );
for ( int i = sampleIdx + 1; i < i_max; i++ )
{
sampleValue += ( ( values[i] & mask ) >> trailingZeros );
}
Expand Down

0 comments on commit 234f8b3

Please sign in to comment.