Read of uninitialized storage through pointer

Storage that was not previously assigned a value was accessed through a pointer.

Memory allocation routines do not necessarily initialize the storage they return.

ID

Observation

Description

1

Uninitialized read

The place the uninitialized memory was read

Example

          
#include <stdio>

int main (int argc, char **argv)
{
    int unknown; // uninitialized variable
    int *p1 = &unknown;
    int *p2 = (int *)malloc(4);
    if (p2) {
        printf("uninitialized values %d %d\n", *p1, *p2);
        free(p2);
    }
    return 0;
}
        

Copyright © 2010, Intel Corporation. All rights reserved.