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

Change-Id: Ia6dc5c91bd43a269852704fde92581d2a1ea20b6