[DO NOT MERGE] Check bounds in offsetToPtr
am: bb6096d37b  -s ours

Change-Id: Ief3269100fb5c0d425e58b4faf87bd73677251b1