Skip to content
Discussion options

You must be logged in to vote

Hi @xlauko,

This is indeed a known limitation of our alias analysis which we perform before computing dataflow. If I understand this sentence correctly:

If I put the copy of the pointer after free, the use is detected. Do I need to augment the isSource predicate somehow?

you're saying that your query does detect this case:

void test()
{
    char* p = (char*)malloc(1);
    if (!p)
        return;

    *p = 'x';
    free(p);
    char* cpy = p;

    char use_after_free = *cpy;
    putchar(use_after_free);
}

which is expected. For various reasons we sometimes treat a read or write to a pointer (i.e., p) as a read or write to the dereferenced value (i.e., *p). So in the case where we do dete…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@xlauko
Comment options

@MathiasVP
Comment options

Answer selected by xlauko
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants