Fix NPE caused by handling GetFileSize return value.
FileBackedVector wasn't properly checking the return value of
GetFileSize when deciding whether or not it needed to grow the
underlying file and remap. If GetFileSize failed due to an IO error,
then FileBackedVector would conclude (incorrectly) that growing wasn't
necessary and would attempt to access the mmapping at the requested
index - which could result in either an NPE (if the vector was empty) or
an invalid memory access (if the requested index exceeded the actual
size of the mmapping). See b/232273174#comment44 for more details.
This is a cherrypick of cl/451040413.
Test: Builds
Change-Id: I7ae0e3119126483c23a85dae3bd7a84712357209
2 files changed