cid#705542 Unintentional integer overflow

Change-Id: Ibd3ef676de7d99ebdd273ee85665ddf9ec0f9c10
cid#982783 Unintentional integer overflow

Change-Id: Ida52d1fbe3d84c9c0070c91ae24cae58dc4aa13f