Visible to Intel only — GUID: GUID-30CC126C-585D-4E8C-B3A8-6DDD886D55B4
Visible to Intel only — GUID: GUID-30CC126C-585D-4E8C-B3A8-6DDD886D55B4
Invalid Partial Memory Access
Occurs when a read or write instruction references a block (2-bytes or more) of memory where part of the block is logically invalid.
ID |
Code Location | Description |
---|---|---|
1 |
Allocation site |
If present, represents the location and associated call stack from which the memory block adjacent to the offending address was allocated. |
2 |
Deallocation site |
If present, represents the location and associated call stack from which the memory block containing the offending address was deallocated. The deallocation makes the access to the offending memory address logically invalid. |
3 |
Read or Write |
Represents the instruction and associated call stack responsible for the partial invalid access. If no allocation or deallocation is associated with this problem, the memory address might be one of the following:
NOTE:
The offset, if shown in the Code Locations pane, represents the byte offset into the allocated buffer where the Invalid partial memory access occurred. |
Example
struct tally { int num; char count; }; struct tally *pCurrent = (struct tally *)malloc(5); // incorrect size allocated struct tally *pRoot = (struct tally *)malloc(sizeof(struct tally)); pCurrent->num = 1; pCurrent->count = 1; *pRoot = *pCurrent; // will result in partial invalid read
Different compilers and optimization levels can produce different assembly for block copies of memory. Depending on the generated assembly, this example might produce an invalid memory access problem.
Possible Correction Strategies
The typical cause of an invalid partial memory access problem is a miscalculation of the required size of an object. Determine the correct size for object creation.