Intel® Inspector User Guide for Linux* OS

ID 767796
Date 7/13/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

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.

Problem type: Invalid partial memory access

Problem type: Invalid memory access (Write)

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:

  • Logically invalid stack space (below the current stack pointer value)

  • Memory that is physically not allocated to the process

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

NOTE:

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.