CRITICAL
Rule Definition
Software featuring weak numerical conversion practices incurs the risk of using the wrong number and generating incorrect results, possibly introducing new vulnerability when related to resource allocation and security decision.
Remediation
Change the data type.
Violation Code Sample
Fixed Code Sample
DATA myChar1(9) TYPE c.
DATA myChar2(9) TYPE c.
myChar1 = myChar2.
------------------------------------------------
DATA myDate TYPE d.
DATA myChar(8) TYPE c.
myDate = myChar.
-------------------------------------------------
DATA myDate TYPE d.
DATA myChar(8) TYPE c.
MOVE myChar to myDate.
-------------------------------------------------
DATA myTime TYPE t.
DATA myChar(6) TYPE c.
myChar= myTime.
-------------------------------------------------
DATA myFloat TYPE f.
DATA myChar(6) TYPE c.
myChar= myFloat.
Reference
ASCSM 1.0, Automated Source Code Security Measure, Object Management Group.
Related Technologies
Technical Criterion
CWE-681 - Incorrect Conversion between Numeric Types
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.