[PATCH] D31868: [analyzer] Check NULL pointer dereference issue for memset function

2017-10-24 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. In https://reviews.llvm.org/D31868#904814, @MTC wrote: > > One of the possible improvements for future work here would be to actually > > bind the second argument value to the buffer instead of just invalidating > > it. Like, after `memset(buf, 0, sizeof(buf))` the analyzer

[PATCH] D31868: [analyzer] Check NULL pointer dereference issue for memset function

2017-10-24 Thread Leslie Zhai via Phabricator via cfe-commits
xiangzhai added a comment. Dear Henry, Sorry for my poor English, please Create a New patch or provide Chinese translation :) Regards, Leslie Zhai Repository: rL LLVM https://reviews.llvm.org/D31868 ___ cfe-commits mailing list cfe-commits@lis

[PATCH] D31868: [analyzer] Check NULL pointer dereference issue for memset function

2017-10-24 Thread Henry Wong via Phabricator via cfe-commits
MTC added a comment. > One of the possible improvements for future work here would be to actually > bind the second argument value to the buffer instead of just invalidating it. > Like, after `memset(buf, 0, sizeof(buf))` the analyzer should know that all > values in the `buf` array are `0`. In

[PATCH] D31868: [analyzer] Check NULL pointer dereference issue for memset function

2017-06-19 Thread Leslie Zhai via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL305773: [analyzer] Check NULL pointer dereference issue for memset function (authored by xiangzhai). Changed prior to commit: https://reviews.llvm.org/D31868?vs=101847&id=103161#toc Repository: rL LL

[PATCH] D31868: [analyzer] Check NULL pointer dereference issue for memset function

2017-06-19 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ accepted this revision. NoQ added a comment. This revision is now accepted and ready to land. Thanks, this was very useful, please commit! Repository: rL LLVM https://reviews.llvm.org/D31868 ___ cfe-commits mailing list cfe-commits@lists.llvm

[PATCH] D31868: [analyzer] Check NULL pointer dereference issue for memset function

2017-06-14 Thread Leslie Zhai via Phabricator via cfe-commits
xiangzhai added a comment. Kindly ping Artem and Anna :) Repository: rL LLVM https://reviews.llvm.org/D31868 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D31868: [analyzer] Check NULL pointer dereference issue for memset function

2017-06-07 Thread Leslie Zhai via Phabricator via cfe-commits
xiangzhai updated this revision to Diff 101847. xiangzhai added a comment. Herald added a subscriber: xazax.hun. Hi Artem, I updated my patch please review it, thanks a lot! Regards, Leslie Zhai Repository: rL LLVM https://reviews.llvm.org/D31868 Files: lib/StaticAnalyzer/Checkers/CStrin

[PATCH] D31868: [analyzer] Check NULL pointer dereference issue for memset function

2017-06-01 Thread Leslie Zhai via Phabricator via cfe-commits
xiangzhai added a comment. Hi Artem, Long time no see! miss you :) I will update my patch next Thursday! I am doing my work assignment about L4 right now. Regards, Leslie Zhai Repository: rL LLVM https://reviews.llvm.org/

[PATCH] D31868: [analyzer] Check NULL pointer dereference issue for memset function

2017-06-01 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. The code looks good now! A few minor comments and we can commit this :) Comment at: lib/StaticAnalyzer/Checkers/CStringChecker.cpp:2010 + const Expr *Mem = CE->getArg(0); + const Expr *Const = CE->getArg(1); + const Expr *Size = CE->getArg(2); --

[PATCH] D31868: [analyzer] Check NULL pointer dereference issue for memset function

2017-04-27 Thread Leslie Zhai via Phabricator via cfe-commits
xiangzhai updated this revision to Diff 97042. xiangzhai added a comment. Hi Artem, Please review my updated patch, 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-r

[PATCH] D31868: [analyzer] Check NULL pointer dereference issue for memset function

2017-04-27 Thread Leslie Zhai via Phabricator via cfe-commits
xiangzhai added a comment. Hi Artem, Thank you so much! you are my mentor teach me patiently and carefully, I will update my patch tomorrow, good night from my timezone:) Regards, Leslie Zhai Repository: rL LLVM https://reviews.llvm.org/D31868 ___

[PATCH] D31868: [analyzer] Check NULL pointer dereference issue for memset function

2017-04-27 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. I've a feeling we need to roll this back a little bit. The `memset()` function does the following: 1. Accesses pointers in range R = [first argument, first argument + third argument] and crashes when accessing an invalid pointer. 2. Writes second argument to all bytes in ra

[PATCH] D31868: [analyzer] Check NULL pointer dereference issue for memset function

2017-04-23 Thread Leslie Zhai via Phabricator via cfe-commits
xiangzhai updated this revision to Diff 96344. xiangzhai added a comment. Hi Artem, Because `memcpy` checked NULL pointer dereference for `src`: state = checkNonNull(C, state, Source, srcVal); ... so such testcase can not point out my fault: void f15 () {

[PATCH] D31868: [analyzer] Check NULL pointer dereference issue for memset function

2017-04-18 Thread Leslie Zhai via Phabricator via cfe-commits
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

[PATCH] D31868: [analyzer] Check NULL pointer dereference issue for memset function

2017-04-18 Thread Leslie Zhai via Phabricator via cfe-commits
xiangzhai added a comment. Hi All, Thanks for your review! I will update my patch tomorrow! Almost 4+ days no see, I miss you :) Regards, Leslie Zhaii Repository: rL LLVM https://reviews.llvm.org/D31868 ___ cfe-commits mailing list cfe-commits

[PATCH] D31868: [analyzer] Check NULL pointer dereference issue for memset function

2017-04-18 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. Wow, so you're doing the binding thing now? Thanks! It was not critical for landing this patch, so you could have fixed comments here, allowing us to commit what's already done, and then proceed with further improvements. It's also easier to review and aligns with the LLVM'

[PATCH] D31868: [analyzer] Check NULL pointer dereference issue for memset function

2017-04-18 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. Please click "Done" on fixed review comments. Comment at: lib/StaticAnalyzer/Checkers/CStringChecker.cpp:2038 + // If the size can be nonzero, we have to check the other arguments. + if (StateNonZeroSize) { +State = StateNonZeroSize; -

[PATCH] D31868: [analyzer] Check NULL pointer dereference issue for memset function

2017-04-18 Thread Leslie Zhai via Phabricator via cfe-commits
xiangzhai added a comment. Hi Artem, If it looks good to you, I want to try commit by myself for testing commit, thanks! Regards, Leslie Zhai Repository: rL LLVM https://reviews.llvm.org/D31868 ___ cfe-commits mailing list cfe-commits@lists.ll

[PATCH] D31868: [analyzer] Check NULL pointer dereference issue for memset function

2017-04-13 Thread Leslie Zhai via Phabricator via cfe-commits
xiangzhai updated this revision to Diff 95273. xiangzhai added a comment. Hi All, I have updated my patch as your suggestion, please review it, thanks a lot! Regards, Leslie Zhai Repository: rL LLVM https://reviews.llvm.org/D31868 Files: lib/StaticAnalyzer/Checkers/CStringChecker.cpp t

[PATCH] D31868: [analyzer] Check NULL pointer dereference issue for memset function

2017-04-13 Thread Leslie Zhai via Phabricator via cfe-commits
xiangzhai added a comment. Hi Artem, Thanks for your review! I will update my patch tomorrow :) Regards, Leslie Zhai Repository: rL LLVM https://reviews.llvm.org/D31868 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.o

[PATCH] D31868: [analyzer] Check NULL pointer dereference issue for memset function

2017-04-13 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. This looks correct! Thanks for taking this up. One of the possible improvements for future work here would be to actually bind the second argument value to the buffer instead of just invalidating it. Like, after `memset(buf, 0, sizeof(buf))` the analyzer should know that al

[PATCH] D31868: [analyzer] Check NULL pointer dereference issue for memset function

2017-04-12 Thread Leslie Zhai via Phabricator via cfe-commits
xiangzhai added a comment. Hi Daniel, Thanks for your review! Sorry I am not available until this Friday, then I will update my patch. Regards, Leslie Zhai Repository: rL LLVM https://reviews.llvm.org/D31868 ___ cfe-commits mailing list cfe-co

[PATCH] D31868: [analyzer] Check NULL pointer dereference issue for memset function

2017-04-12 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. Thanks! Looks like a valueable addition. Comment at: lib/StaticAnalyzer/Checkers/CStringChecker.cpp:2004 +void CStringChecker::evalMemset(CheckerContext &C, const CallExpr *CE) const { + if (CE->getNumArgs() < 3) +return; e

[PATCH] D31868: [analyzer] Check NULL pointer dereference issue for memset function

2017-04-10 Thread Leslie Zhai via Phabricator via cfe-commits
xiangzhai created this revision. Hi LLVM developers, As Anna mentioned: > One idea is to check that we do not pass a pointer that is known to be NULL > to functions that are known to dereference pointers such as memcpy. There is > a checker that determines if a null pointer could be dereferenc