Absolute address usage
Absolute address is assigned to pointer
Description
This check appears when an absolute address is assigned to a pointer.
By default, this check is green. The software assumes the following about the absolute address:
The address is valid.
The type of the pointer to which you assign the address determines the initial value stored in the address.
If you assign the address to an
int*
pointer, the memory zone that the address points to is initialized with anint
value. The value can be anything allowed for the data typeint
.
The analysis makes these assumptions regarding absolute address usage:
The check does not flag absolute addresses if they involve variables or pointer arithmetic. For example, the
x = *(int*)0x7
address is considered an absolute address. Thex = *(int*)(0x7 + y)
address is not an absolute address due its use of variables.If you assign an absolute address to a pointer, the analysis assumes that the pointed location can contain any value allowed for the pointed data type. For example, following
ptr = (int*)0x32
, the analysis assumes that*ptr
can contain anyint
value. Following a sequence of casts such asptr = (int*)(char*)0x32
, the analysis takes into account only the outermost cast, in this case,int*
.
To turn this check orange by default for each absolute address usage, use the command-line
option -no-assumption-on-absolute-addresses
.
Diagnosing This Check
Examples
Check Information
Group: Static memory |
Language: C | C++ |
Acronym: ABS_ADDR |