New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C++: Return statement inside Guard Block #15001
Comments
|
Hi @tardigrade-9, The problem isn't actually the if(condition()) {
x = source();
if(!safe(x)) {
return;
}
}
sink(x);where we want to put a barrier on code guarded by The We do have some ideas for how we could make this work. But for now there's no good way to handle this FP. I'll add your example to our internal issue that tracks this. |
|
Thanks @MathiasVP for clarification. |
|
@MathiasVP I modified the functions to have condition on test I get path something like |
|
Hi @tardigrade-9, I'm not sure what you mean. Your modified snippet still fits the general pattern that I said we couldn't handle (where Could you clarify what you meant in your last post? |
|
Sorry for misunderstanding. The pattern you mentioned is But if you see source is not within the condition block. Source is functioncall func2(2,NULL(=source)). And I've added condition on And the path I'm getting is source as func2 parameter, to sink x. But previously the source was new_source(). I hope this is clear. Thanks! |

Is the dataFlow guarded if the condition has return statement?
Here's the code
Here's the query
Output:
1.test=NULL, -> test[0].a , this is TP
2. calloc() , -> test[0].a , this is FP because when calloc return null, test[0] is unreachable..
two more results for test[1], which is same as above..
Is this because Guard Condition can't see the return statement inside the conditional block?
The text was updated successfully, but these errors were encountered: