C++: Fix false positive by restricting _both_ the old (unconverted) expression _and_ all of the conversions.

This commit is contained in:
Mathias Vorreiter Pedersen
2021-05-10 15:18:42 +02:00
parent c7cd75437f
commit c0b65314be
2 changed files with 3 additions and 1 deletions

View File

@@ -49,6 +49,9 @@ where
small = rel.getLesserOperand() and
large = rel.getGreaterOperand() and
rel = l.getCondition().getAChild*() and
forall(Expr conv | conv = large.getConversion*() |
upperBound(conv).log2() > getComparisonSize(small) * 8
) and
upperBound(large.getFullyConverted()).log2() > getComparisonSize(small) * 8 and
// Ignore cases where the smaller type is int or larger
// These are still bugs, but you should need a very large string or array to