SVF icon indicating copy to clipboard operation
SVF copied to clipboard

SVF fails to trace the value flow of the pointer that is transfered to the upper-layer function with a parameter

Open spingARbor opened this issue 2 years ago • 4 comments

Hi,sir I wrote a Demo in which a pointer allocated in a function was transfered to the function's caller with its parameter. And ,I found the VFG of the pointer was broken at the callsite which caused a false alarm that the pointer was leaked.So , Dose SVF fail to trace the value flow of the pointer that is transfered to the upper-layer function with a parameter? The demo as following: `void transfptr(int **p) { int p1 = (int)malloc(sizeof(int)); *p = p1; }

int main() { int **p; transfptr(p); free(*p); return 1; }`

spingARbor avatar Mar 07 '22 13:03 spingARbor

Your program is broken. It is supposed that p1 is a pointer type rather than int?

yuleisui avatar Mar 07 '22 13:03 yuleisui

sorry,I got somthing wrong when copying

void transfptr(int **p)
{
    int *p1 = (int*)malloc(sizeof(int));
    *p = p1;
}

int main()
{
    int **p;
    transfptr(p);
    free(*p);
    return 1;
}

spingARbor avatar Mar 07 '22 13:03 spingARbor

p is a null pointer? How could you dereferencing it..

yuleisui avatar Mar 07 '22 13:03 yuleisui

Thanks for your help and sorry for wasting your time,sir . My problem is because of my coding error.

spingARbor avatar Mar 07 '22 14:03 spingARbor