Introduce checks for integer overflow during division.

Historically, Android would refuse to
perform calculations on memory grounds for large values
or would cast to an int and produce incorrect result for
diffScales outside of the int range.

This change adds a check to prevent scale overflow for
large scale division.

Bug: 17393664

(cherry picked from commit f7cf74a44b2f5ff863de0d82d2efb6d17240ab3e)

Change-Id: I94c829f184804a4fcbed67a180b7ce9684652311
1 file changed