Merge "Fix unsigned integer overflow of i, which gives SIGABRT" am: 8db23af93b am: 1886fb446c

Change-Id: Ib46e01ea4d6d5e22d4a8f9324fb4bc42ddd191b0