Fix a couple overflows spotted by Coverity.