Re: [PATCH] D9924: Ignore report when the argument to malloc is assigned known value

2015-09-22 Thread Aditya Kumar via cfe-commits
hiraditya updated this revision to Diff 35461. hiraditya added a comment. Updated commit message and summary. http://reviews.llvm.org/D9924 Files: lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp test/Analysis/malloc-overflow.c test/Analysis/malloc-overflow2.c Index: test/An

Re: [PATCH] D9924: Ignore report when the argument to malloc is assigned known value

2015-09-22 Thread Devin Coughlin via cfe-commits
dcoughlin added a comment. Aditya, can you update the patch title and summary to a commit message so I can commit it? Thanks! http://reviews.llvm.org/D9924 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailma

Re: [PATCH] D9924: Ignore report when the argument to malloc is assigned known value

2015-09-10 Thread Aditya Kumar via cfe-commits
hiraditya added a comment. Hi Anna, I have updated the patch to address the changes you asked for. http://reviews.llvm.org/D9924 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Re: [PATCH] D9924: Ignore report when the argument to malloc is assigned known value

2015-09-10 Thread Aditya Kumar via cfe-commits
hiraditya updated this revision to Diff 34525. hiraditya added a comment. Emit warning when numerator is unknown (may overflow). The checker will ignore warning when numerator and denominator are both known. Added test case. Format patch with clang-format. http://reviews.llvm.org/D9924 Files:

Re: [PATCH] D9924: Ignore report when the argument to malloc is assigned known value

2015-09-09 Thread Anna Zaks via cfe-commits
zaks.anna added a comment. > > If a' might overflow, then in this case we can emit warning stating that > > the overflow is caused because a' might overflow. > > > I see your point now! I think we should improve the diagnostic that is > produced in this case! How was the following comment

Re: [PATCH] D9924: Ignore report when the argument to malloc is assigned known value

2015-09-09 Thread Aditya Kumar via cfe-commits
hiraditya updated this revision to Diff 34323. hiraditya added a comment. Rebase with latest changes. http://reviews.llvm.org/D9924 Files: lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp test/Analysis/malloc-overflow.c test/Analysis/malloc-overflow2.c Index: test/Analysis/m

Re: [PATCH] D9924: Ignore report when the argument to malloc is assigned known value

2015-09-08 Thread Aditya Kumar via cfe-commits
hiraditya added a comment. Please review my patch. Thanks. http://reviews.llvm.org/D9924 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Re: [PATCH] D9924: Ignore report when the argument to malloc is assigned known value

2015-08-18 Thread Aditya Kumar via cfe-commits
hiraditya updated this revision to Diff 32381. hiraditya added a comment. Refactored the code and check whether denominator > 0. http://reviews.llvm.org/D9924 Files: lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp test/Analysis/malloc-overflow.c test/Analysis/malloc-overflow

RE: [PATCH] D9924: Ignore report when the argument to malloc is assigned known value

2015-08-17 Thread Aditya K via cfe-commits
l.com > CC: cfe-commits@lists.llvm.org > Subject: Re: [PATCH] D9924: Ignore report when the argument to malloc is > assigned known value > > zaks.anna added a comment. > >> Maybe, I should add a check that `a, b, n' are positive. > >> So, in this case sta

Re: [PATCH] D9924: Ignore report when the argument to malloc is assigned known value

2015-08-17 Thread Anna Zaks via cfe-commits
zaks.anna added a comment. > Maybe, I should add a check that `a, b, n' are positive. > So, in this case static analyzer can choose to be strict and reject false > positives. What would this buy us? Does the checker warn on underflow? > If a' might overflow, then in this case we can emit war

RE: [PATCH] D9924: Ignore report when the argument to malloc is assigned known value

2015-08-17 Thread Aditya K via cfe-commits
l.com > CC: cfe-commits@lists.llvm.org > Subject: Re: [PATCH] D9924: Ignore report when the argument to malloc is > assigned known value > > zaks.anna added a comment. > >> x = a/b; where n < b > >> malloc (x*n); Then x*n will not overflow > > > I am not

Re: [PATCH] D9924: Ignore report when the argument to malloc is assigned known value

2015-08-17 Thread Anna Zaks via cfe-commits
zaks.anna added a comment. > x = a/b; where n < b > malloc (x*n); Then x*n will not overflow I am not convinced that the new rule is strong enough. 'a' can be any expression. For example, maybe you have (b-1)*a/b and the denominator cancels out something unrelated to 'n' in the numerator? Ma

Re: [PATCH] D9924: Ignore report when the argument to malloc is assigned known value

2015-08-12 Thread Aditya Kumar via cfe-commits
hiraditya updated this revision to Diff 31913. hiraditya added a comment. Added free, to avoid an unrelated warning. http://reviews.llvm.org/D9924 Files: lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp test/Analysis/malloc-overflow.c test/Analysis/malloc-overflow2.c Index:

Re: [PATCH] D9924: Ignore report when the argument to malloc is assigned known value

2015-08-12 Thread Aditya Kumar via cfe-commits
hiraditya updated this revision to Diff 31904. hiraditya added a comment. Added comments and changed the variable name. http://reviews.llvm.org/D9924 Files: lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp test/Analysis/malloc-overflow.c test/Analysis/malloc-overflow2.c Inde

Re: [PATCH] D9924: Ignore report when the argument to malloc is assigned known value

2015-08-12 Thread Aditya Kumar via cfe-commits
hiraditya added inline comments. Comment at: lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp:182 @@ +181,3 @@ + if (rhs->isEvaluatable(Context)) +eraseAssign = true; + // Erase if the multiplicand was assigned a value, zaks.anna wro

Re: [PATCH] D9924: Ignore report when the argument to malloc is assigned known value

2015-08-06 Thread Anna Zaks via cfe-commits
zaks.anna added a comment. Thanks! See the comments inline. Comment at: lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp:182 @@ +181,3 @@ + if (rhs->isEvaluatable(Context)) +eraseAssign = true; + // Erase if the multiplicand was assigned a value, -