Multiplying gint values may overflow unless cast into a larger type. (cherry picked from commit a9671395)