Merge "Minor type cast fixes for UBSan" am: dd1492e588 am: cce6caac11
am: edf5d3126f

Change-Id: I8183d8cd9bb28fe685e8cad314523a28e8c2db0a