fix int overflow
Merge pull request #1226 from WalterBright/fixintoverflow

fix int overflow