@@ -657,24 +657,16 @@ private predicate indirectConversionFlowStep(Node nFrom, Node nTo) {
657
657
* So this predicate recurses back along conversions and `PointerArithmeticInstruction`s to find the
658
658
* first use that has provides use-use flow, and uses that target as the target of the `nodeFrom`.
659
659
*/
660
- private predicate adjustForPointerArith (
661
- DefOrUse defOrUse , Node nodeFrom , UseOrPhi use , boolean uncertain
662
- ) {
663
- nodeFrom = any ( PostUpdateNode pun ) .getPreUpdateNode ( ) and
664
- exists ( Node adjusted |
665
- indirectConversionFlowStep * ( adjusted , nodeFrom ) and
666
- nodeToDefOrUse ( adjusted , defOrUse , uncertain ) and
660
+ private predicate adjustForPointerArith ( PostUpdateNode pun , UseOrPhi use ) {
661
+ exists ( DefOrUse defOrUse , Node adjusted |
662
+ indirectConversionFlowStep * ( adjusted , pun .getPreUpdateNode ( ) ) and
663
+ nodeToDefOrUse ( adjusted , defOrUse , _) and
667
664
adjacentDefRead ( defOrUse , use )
668
665
)
669
666
}
670
667
671
668
private predicate ssaFlowImpl ( SsaDefOrUse defOrUse , Node nodeFrom , Node nodeTo , boolean uncertain ) {
672
- // `nodeFrom = any(PostUpdateNode pun).getPreUpdateNode()` is implied by adjustedForPointerArith.
673
669
exists ( UseOrPhi use |
674
- adjustForPointerArith ( defOrUse , nodeFrom , use , uncertain ) and
675
- useToNode ( use , nodeTo )
676
- or
677
- not nodeFrom = any ( PostUpdateNode pun ) .getPreUpdateNode ( ) and
678
670
nodeToDefOrUse ( nodeFrom , defOrUse , uncertain ) and
679
671
adjacentDefRead ( defOrUse , use ) and
680
672
useToNode ( use , nodeTo ) and
@@ -719,14 +711,19 @@ predicate ssaFlow(Node nodeFrom, Node nodeTo) {
719
711
)
720
712
}
721
713
714
+ private predicate isArgumentOfCallable ( DataFlowCall call , ArgumentNode arg ) {
715
+ arg .argumentOf ( call , _)
716
+ }
717
+
718
+ /** Holds if there is def-use or use-use flow from `pun` to `nodeTo`. */
722
719
predicate postUpdateFlow ( PostUpdateNode pun , Node nodeTo ) {
723
- exists ( Node preUpdate , Node nFrom , boolean uncertain , SsaDefOrUse defOrUse |
720
+ exists ( UseOrPhi use , Node preUpdate |
721
+ adjustForPointerArith ( pun , use ) and
722
+ useToNode ( use , nodeTo ) and
724
723
preUpdate = pun .getPreUpdateNode ( ) and
725
- ssaFlowImpl ( defOrUse , nFrom , nodeTo , uncertain )
726
- |
727
- if uncertain = true
728
- then preUpdate = [ nFrom , getAPriorDefinition ( defOrUse ) ]
729
- else preUpdate = nFrom
724
+ not exists ( DataFlowCall call |
725
+ isArgumentOfCallable ( call , preUpdate ) and isArgumentOfCallable ( call , nodeTo )
726
+ )
730
727
)
731
728
}
732
729
0 commit comments