[PATCH] D55007: [Analyzer] Constraint Manager - Calculate Effective Range for Differences

Balogh, Ádám via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 18 06:17:57 PST 2019


baloghadamsoftware added a comment.

In D55007#1322335 <https://reviews.llvm.org/D55007#1322335>, @NoQ wrote:

> I just generally wish for a function that would return the most specific known range for the given arbitrary symbol. This is something we can put, for example, into visitor path notes.
>
> Eg., imagine "Assuming x is greater than 5" -> "Tainted array index constrained to [5, 6] U {8} U [10, 12]" -> "Potential buffer overflow: accessing array of 11 elements with a tainted index".
>
> `getRange()` is a great name for such function. For now i think it kinda works for atomic symbols with a few extra goodies on top of that. If we generally move towards that goal, i think it would be great.


I think my patch is exactly about this for symbol differences: it returns the most specific known range for the difference by intersecting the range stored for the differences with the range stored for the negated difference.

It may be better not to store the difference for the negated range at all, but it is a bigger change in the code. (See my options 1 and 2.)


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55007/new/

https://reviews.llvm.org/D55007





More information about the cfe-commits mailing list