add a check for potential integer overflows

Test: mma
Change-Id: I43b79325f33c126b60e1261abff8ea29bd3de13c
1 file changed