@@ -76,8 +76,7 @@ module ControlFlowReachability<InputSig Input> {
7676 }
7777}
7878
79- from FunctionCall fcall , TimeConversionFunction trf , Variable var
80- where
79+ predicate isUnpackedTimeTypeVar ( Variable var , FunctionCall fcall , TimeConversionFunction trf ) {
8180 fcall = trf .getACallToThisFunction ( ) and
8281 fcall instanceof ExprInVoidContext and
8382 var .getUnderlyingType ( ) instanceof UnpackedTimeType and
@@ -91,11 +90,36 @@ where
9190 fcall .getAnArgument ( ) = va and
9291 var .getAnAccess ( ) = va
9392 )
94- ) and
95- exists ( DateStructModifiedFieldAccess dsmfa , VariableAccess modifiedVarAccess |
93+ )
94+ }
95+
96+ predicate isModifiedFieldAccessToTimeConversionSource (
97+ ControlFlowNode modifiedVarAccess , Variable var
98+ ) {
99+ exists ( DateStructModifiedFieldAccess dsmfa |
100+ isUnpackedTimeTypeVar ( var , _, _) and
96101 modifiedVarAccess = var .getAnAccess ( ) and
97- modifiedVarAccess = dsmfa .getQualifier ( ) and
98- modifiedVarAccess = fcall .getAPredecessor * ( )
102+ modifiedVarAccess = dsmfa .getQualifier ( )
103+ )
104+ }
105+
106+ module ModifiedFieldAccessToTimeConversionConfig implements InputSig {
107+ predicate isSource ( ControlFlowNode modifiedVarAccess ) {
108+ isModifiedFieldAccessToTimeConversionSource ( modifiedVarAccess , _)
109+ }
110+
111+ predicate isSink ( ControlFlowNode fcall ) { isUnpackedTimeTypeVar ( _, fcall , _) }
112+ }
113+
114+ module ModifiedFieldAccessToTimeConversion =
115+ ControlFlowReachability< ModifiedFieldAccessToTimeConversionConfig > ;
116+
117+ from FunctionCall fcall , TimeConversionFunction trf , Variable var
118+ where
119+ isUnpackedTimeTypeVar ( var , fcall , trf ) and
120+ exists ( VariableAccess modifiedVarAccess |
121+ isModifiedFieldAccessToTimeConversionSource ( modifiedVarAccess , var ) and
122+ ModifiedFieldAccessToTimeConversion:: flowsTo ( modifiedVarAccess , fcall )
99123 ) and
100124 // Remove false positives
101125 not (
0 commit comments