@@ -377,15 +377,19 @@ predicate hasFlowPath(
377377}
378378
379379from
380- MergedPathNode source , MergedPathNode sink , int k2 , int k3 , string kstr ,
381- InvalidPointerToDerefFlow:: PathNode source3 , PointerArithmeticInstruction pai , string operation ,
382- Expr offset , DataFlow:: Node n
380+ MergedPathNode source , MergedPathNode sink , int k , string kstr , PointerArithmeticInstruction pai ,
381+ string operation , Expr offset , DataFlow:: Node n
383382where
384- hasFlowPath ( source , sink , source3 , pai , operation , k3 ) and
385- invalidPointerToDerefSource ( pai , source3 .getNode ( ) , k2 ) and
383+ k =
384+ min ( int k2 , int k3 , InvalidPointerToDerefFlow:: PathNode source3 |
385+ hasFlowPath ( source , sink , source3 , pai , operation , k3 ) and
386+ invalidPointerToDerefSource ( pai , source3 .getNode ( ) , k2 )
387+ |
388+ k2 + k3
389+ ) and
386390 offset = pai .getRight ( ) .getUnconvertedResultExpression ( ) and
387391 n = source .asPathNode1 ( ) .getNode ( ) and
388- if ( k2 + k3 ) = 0 then kstr = "" else kstr = " + " + ( k2 + k3 )
392+ if k = 0 then kstr = "" else kstr = " + " + k
389393select sink , source , sink ,
390394 "This " + operation + " might be out of bounds, as the pointer might be equal to $@ + $@" + kstr +
391395 "." , n , n .toString ( ) , offset , offset .toString ( )
0 commit comments