Rule Definition
Since the conversion applies after the multiplication, arithmetic overflow may still occur.
Explicit Conversion is considered as an indication that the final result may be larger than type range.
Remediation
Cast the elements to larger type also.
Violation Code Sample
int i = 2000000000;
long j = i * i;//Violation
Fixed Code Sample
long k = (long) i * i; //Fixed
Reference
http://www.cplusplus.com/articles/DE18T05o/ - Multiplication
https://cwe.mitre.org/data/definitions/190.html
Related Technologies
Technical Criterion
CWE-682 - Incorrect Calculation [Pillar]
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.