Integer overflow protection in brute-force test