[PATCH] D31868: [analyzer] Check NULL pointer dereference issue for memset function
Leslie Zhai via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 18 23:39:52 PDT 2017
xiangzhai updated this revision to Diff 95690.
xiangzhai added a comment.
Hi Artem,
> so you're doing the binding thing now?
No! it only works for `RetVal` for example `int *ret = memset(x, 0, sizeof(int));`, please see my testcase:
void foo() {
int *x = malloc(sizeof(int));
int *ret = memset(x, 0, sizeof(int));
int n = 1 / *ret; // expected-warning {{Division by zero}}
free(x);
}
but not work for `MemVal` for example `int n = 1 / *x;`
Please carefully review my patch to point out my fault: wrongly use `bindDefault`? thanks a lot!
Regards,
Leslie Zhai
Repository:
rL LLVM
https://reviews.llvm.org/D31868
Files:
lib/StaticAnalyzer/Checkers/CStringChecker.cpp
test/Analysis/null-deref-ps-region.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31868.95690.patch
Type: text/x-patch
Size: 5613 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170419/57066994/attachment-0001.bin>
More information about the cfe-commits
mailing list