diff
- while (i < size && sieve[++i] == 0)
+ while (i < size - 1 && sieve[++i] == 0);
