Fix the bug that int overflow can bypass the range check
Merge pull request #1269 from zsxwing/range-overflow

Fix the bug that int overflow can bypass the range check