1494
Applicable Platforms
Language : Not Language-Specific (Prevalence = Undetermined)
Common Consequences
Scope Impact Likelihood
Integrity
Availability
Confidentiality
Modify Memory
DoS: Crash, Exit, or Restart
Execute Unauthorized Code or Commands
Demonstrative Examples
Example 1:
The following image processing code allocates a table for images.
Example Language: C (Bad)
img_t table_ptr; /*struct containing img data, 10kB each*/
int num_imgs;
...
num_imgs = get_num_imgs();
table_ptr = (img_t*)malloc(sizeof(img_t)*num_imgs);
...
This code intends to allocate a table of size num_imgs, however as num_imgs grows large, the
calculation determining the size of the list will eventually overflow (CWE-190). This will result in
a very small list to be allocated instead. If the subsequent code operates on the list as if it were
num_imgs long, it may result in many types of out-of-bounds problems (CWE-119).
Observed Examples
Reference Description
CVE-2021-43537 Chain: in a web browser, an unsigned 64-bit integer is forcibly cast to a 32-bit
integer (CWE-681) and potentially leading to an integer overflow (CWE-190).
If an integer overflow occurs, this can cause heap memory corruption
(CWE-122)
https://www.cve.org/CVERecord?id=CVE-2021-43537
CVE-2017-1000121chain: unchecked message size metadata allows integer overflow (CWE-190)
leading to buffer overflow (CWE-119).
https://www.cve.org/CVERecord?id=CVE-2017-1000121
MemberOf Relationships
This MemberOf relationships table shows additional CWE Catgeories and Views that reference this
weakness as a member. This information is often useful in understanding where a weakness fits
within the context of external information sources.
Nature Type ID Name Page
MemberOf 1158 SEI CERT C Coding Standard - Guidelines 04. Integers
(INT)
1154 2456
MemberOf 1162 SEI CERT C Coding Standard - Guidelines 08. Memory
Management (MEM)
1154 2458
MemberOf 1399 Comprehensive Categorization: Memory Safety 1400 2525
Taxonomy Mappings
Mapped Taxonomy Name Node ID Fit Mapped Node Name
CERT C Secure Coding INT30-C Imprecise Ensure that unsigned integer
operations do not wrap
CERT C Secure Coding INT32-C Imprecise Ensure that operations on signed
integers do not result in overflow
CWE Version 4.14
CWE-681: Incorrect Conversion between Numeric Types
CWE-681: Incorrect Conversion between Numeric Types