
<       for (s = 0; s < spp; s++)
---
>       for (s = 0; s < spp && s < MAX_SAMPLES; s++)
