SampleTable: check integer overflow during table alloc

Bug: 15328708
Bug: 15342615
Bug: 15342751
Change-Id: I6bb110a1eba46506799c73be8ff9a4f71c7e7053
(cherry picked from commit edd4a76eb4747bd19ed122df46fa46b452c12a0d)