You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description of the issue
CodeQL seems to not handle data flow and taint tracking through fields of structs the way I expected when accessed through a pointer.
It's possible that I am misusing the library, but I would have expected the two cases below to behave basically identically under dataflow or taint tracking.
Mini reproducer
#include<stdlib.h>structA { intdummy; };
structB { structA*ptr; };
intmain(intargc, char**argv)
{
structBb= {0};
structB*b_ptr=&b;
structA*a_ptr=NULL;
//Flow from malloc into if stmt not identified by query belowb_ptr->ptr=malloc(sizeof(*b_ptr->ptr));
if(!b_ptr->ptr)
return-1;
//Flow from malloc into if stmt correctly identified by query belowa_ptr=malloc(sizeof(*a_ptr));
if(!a_ptr)
return-1;
return0;
}
I am trying to query missing null checks after an allocation.
The query below only finds the second call to malloc and the corresponding if statement.
I would expect flow through pointers to only work for global dataflow and not for local data flow that you use above. While global data flow is normally allowed to track flow into/out of function calls, you can limit it to sources and sinks in the same function by implementing the getAFeature predicate like here.
Description of the issue
CodeQL seems to not handle data flow and taint tracking through fields of structs the way I expected when accessed through a pointer.
It's possible that I am misusing the library, but I would have expected the two cases below to behave basically identically under dataflow or taint tracking.
Mini reproducer
I am trying to query missing null checks after an allocation.
The query below only finds the second call to
malloc
and the corresponding if statement.I have observed the same behaviour using TaintTracking instead of DataFlow.
The text was updated successfully, but these errors were encountered: