-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
UseAfterFree.ql miss case 01 #13897
Comments
Hi @18Fl, Thanks for bringing this to our attention. The problem is that the query uses I tried to replace all of our uses of I'll add your example to our tracking issue for this query and be sure to mention on this issue whenever this is fixed. |
Thanks for your reply. I will wait for this. Because I have tried change Another problem is when I saw the code in the UseAfterFree.ql, It always use This is what I observed, hope it will help u a little when u work on fix the issue. And another code sample will maybe help u fix the bug: #include <stdlib.h>
#include <stdio.h>
struct MyStruct {
char* buf;
};
// Use-after-free of `buf` field.
static void test0100() {
struct MyStruct* s = (struct MyStruct*)malloc(sizeof(struct MyStruct));
s->buf = (char *)malloc(0x1000);
char * s_buf = s->buf; // [+] I write the code just at here, so maybe it will caused grammer error, I hope it not
sprintf(s->buf, "kevwozere: %d\n", 100);
free(s_buf);
s_buf[0] = 0x41;
free(s);
}
int main() {
test0100();
return 0;
} Thanks! |
Hey, When I try to learn codeql dataflow analysis from UseAfterFree.ql, I found it miss handle some case like I mentioned in github slack. I just paste it at here:
This code can't handle by UseAfterFree.ql , I don't know why. I previouly think it should be caused by "flow after or before mis match"(Which I mentioned in github slack), But seems it's not the root cause . Because the UseAfterFree.ql always use as.Expr() which still handle some case. So I don't know how to inverstigate this one:
The text was updated successfully, but these errors were encountered: