[PATCH] D9924: Ignore report when the argument to malloc is assigned known value
Anna Zaks via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 17 12:29:29 PDT 2015
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? Maybe we could change the rule to "where n==b"? By the way, that is the only subcase that is being tested.
> With regards to copy paste, I'm not sure about how to do this in a different way.
I suggest to experiment with refactoring out common parts into subroutines.
http://reviews.llvm.org/D9924
More information about the cfe-commits
mailing list