@@ -520,7 +520,7 @@ module InterModulePointsTo {
520520 exists ( string name , ModuleObjectInternal mod , CfgOrigin orig |
521521 from_import_imports ( f , context , mod , name ) and
522522 ( mod .getSourceModule ( ) != f .getEnclosingModule ( ) or mod .isBuiltin ( ) ) and
523- mod .attribute ( name , value , origin ) and
523+ mod .attribute ( name , value , orig ) and
524524 origin = orig .asCfgNodeOrHere ( f )
525525 // TO DO... $ variables.
526526 //mod.getSourceModule() = f.getEnclosingModule() and
@@ -697,8 +697,8 @@ module InterProceduralPointsTo {
697697 named_parameter_points_to ( def , context , value , origin )
698698 or
699699 default_parameter_points_to ( def , context , value , origin )
700- // or
701- // special_parameter_points_to(def, context, value, origin)
700+ or
701+ special_parameter_points_to ( def , context , value , origin )
702702 }
703703
704704 /** Helper for `parameter_points_to` */
@@ -745,6 +745,30 @@ module InterProceduralPointsTo {
745745 )
746746 }
747747
748+ /** Helper for parameter_points_to */
749+ pragma [ noinline]
750+ private predicate special_parameter_points_to ( ParameterDefinition def , PointsToContext context , ObjectInternal value , ControlFlowNode origin ) {
751+ context .isRuntime ( ) and
752+ origin = def .getDefiningNode ( ) and
753+ exists ( ControlFlowNode param |
754+ param = def .getDefiningNode ( ) |
755+ exists ( Function func | func .getVararg ( ) = param .getNode ( ) ) and value = TUnknownInstance ( ObjectInternal:: builtin ( "tuple" ) )
756+ or
757+ exists ( Function func | func .getKwarg ( ) = param .getNode ( ) ) and value = TUnknownInstance ( ObjectInternal:: builtin ( "dict" ) )
758+ )
759+ or
760+ exists ( PointsToContext caller , CallNode call , Function f , Parameter p |
761+ context .fromCall ( call , caller ) and
762+ context .appliesToScope ( f ) and
763+ f .getAnArg ( ) = p and p = def .getParameter ( ) and
764+ not p .isSelf ( ) and
765+ not exists ( call .getArg ( p .getPosition ( ) ) ) and
766+ not exists ( call .getArgByName ( p .getName ( ) ) ) and
767+ ( exists ( call .getNode ( ) .getKwargs ( ) ) or exists ( call .getNode ( ) .getStarargs ( ) ) ) and
768+ value = ObjectInternal:: unknown ( ) and origin = def .getDefiningNode ( )
769+ )
770+ }
771+
748772 /** Holds if the `(argument, caller)` pair matches up with `(param, callee)` pair across call. */
749773 cached predicate callsite_argument_transfer ( ControlFlowNode argument , PointsToContext caller , ParameterDefinition param , PointsToContext callee ) {
750774 exists ( CallNode call , Function func , int n , int offset |
0 commit comments