@@ -1025,49 +1025,50 @@ private static function getFunctionCallReturnType(
1025
1025
1026
1026
if ($ codebase ->taint
1027
1027
&& $ function_storage
1028
- && $ function_storage ->return_source_params
1029
1028
&& $ stmt_type
1030
1029
&& $ codebase ->config ->trackTaintsInPath ($ statements_analyzer ->getFilePath ())
1031
1030
) {
1032
- foreach ($ function_storage ->return_source_params as $ i ) {
1033
- if (!isset ($ stmt ->args [$ i ])) {
1034
- continue ;
1035
- }
1031
+ $ return_location = new CodeLocation ($ statements_analyzer ->getSource (), $ stmt );
1036
1032
1037
- $ arg_location = new CodeLocation (
1038
- $ statements_analyzer ->getSource (),
1039
- $ stmt ->args [$ i ]->value
1040
- );
1033
+ $ function_return_sink = TaintNode::getForMethodReturn (
1034
+ $ function_id ,
1035
+ $ function_id ,
1036
+ $ return_location ,
1037
+ $ function_storage ->specialize_call ? $ return_location : null
1038
+ );
1041
1039
1042
- $ return_location = new CodeLocation ( $ statements_analyzer -> getSource (), $ stmt );
1040
+ $ codebase -> taint -> addTaintNode ( $ function_return_sink );
1043
1041
1044
- $ function_param_sink = TaintNode::getForMethodArgument (
1045
- $ function_id ,
1046
- $ function_id ,
1047
- $ i ,
1048
- $ arg_location ,
1049
- $ function_storage ->specialize_call ? $ return_location : null
1050
- );
1042
+ $ stmt_type ->parent_nodes [] = $ function_return_sink ;
1051
1043
1052
- $ codebase ->taint ->addTaintNode ($ function_param_sink );
1044
+ if ($ function_storage ->return_source_params ) {
1045
+ foreach ($ function_storage ->return_source_params as $ i ) {
1046
+ if (!isset ($ stmt ->args [$ i ])) {
1047
+ continue ;
1048
+ }
1053
1049
1054
- $ function_return_sink = TaintNode::getForMethodReturn (
1055
- $ function_id ,
1056
- $ function_id ,
1057
- $ return_location ,
1058
- $ function_storage ->specialize_call ? $ return_location : null
1059
- );
1050
+ $ arg_location = new CodeLocation (
1051
+ $ statements_analyzer ->getSource (),
1052
+ $ stmt ->args [$ i ]->value
1053
+ );
1060
1054
1061
- $ codebase ->taint ->addTaintNode ($ function_return_sink );
1055
+ $ function_param_sink = TaintNode::getForMethodArgument (
1056
+ $ function_id ,
1057
+ $ function_id ,
1058
+ $ i ,
1059
+ $ arg_location ,
1060
+ $ function_storage ->specialize_call ? $ return_location : null
1061
+ );
1062
1062
1063
- $ codebase ->taint ->addPath (
1064
- $ function_param_sink ,
1065
- $ function_return_sink ,
1066
- $ function_storage ->added_taints ,
1067
- $ function_storage ->removed_taints
1068
- );
1063
+ $ codebase ->taint ->addTaintNode ($ function_param_sink );
1069
1064
1070
- $ stmt_type ->parent_nodes [] = $ function_return_sink ;
1065
+ $ codebase ->taint ->addPath (
1066
+ $ function_param_sink ,
1067
+ $ function_return_sink ,
1068
+ $ function_storage ->added_taints ,
1069
+ $ function_storage ->removed_taints
1070
+ );
1071
+ }
1071
1072
}
1072
1073
}
1073
1074
0 commit comments