File tree Expand file tree Collapse file tree 3 files changed +10
-3
lines changed
lib/semmle/go/dataflow/internal
test/library-tests/semmle/go/dataflow/ExternalFlowInheritance Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -377,7 +377,8 @@ module SourceSinkInterpretationInput implements
377377 or
378378 n2 .asExpr ( ) = n .asInstruction ( ) .( IR:: EvalImplicitDerefInstruction ) .getOperand ( )
379379 |
380- result = lookThroughPointerType ( skipImplicitFieldReads ( n2 ) .getType ( ) )
380+ result =
381+ maybeLookThroughNamedType ( lookThroughPointerType ( skipImplicitFieldReads ( n2 ) .getType ( ) ) )
381382 )
382383 }
383384
@@ -395,6 +396,12 @@ module SourceSinkInterpretationInput implements
395396 .getBaseInstruction ( )
396397 }
397398
399+ private DefinedType maybeLookThroughNamedType ( DefinedType t ) {
400+ // We do not have information on what a defined type is defined to be, only
401+ // the underlying type, so we have to be a bit imprecise.
402+ result .getBaseType ( ) = t .getBaseType ( )
403+ }
404+
398405 /** Provides additional sink specification logic. */
399406 bindingset [ c]
400407 predicate interpretOutput ( string c , InterpretNode mid , InterpretNode node ) {
Original file line number Diff line number Diff line change @@ -91,5 +91,5 @@ func TestFieldsRedefinedP1(t test.RedefinedP1) {
9191
9292func TestFieldsRedefinedS1 (t test.RedefinedS1 ) {
9393 a := t .SourceField
94- t .SinkField = a // $ ql_S1 MISSING: S1[f] S1[t]
94+ t .SinkField = a // $ S1[f] S1[t] ql_S1
9595}
Original file line number Diff line number Diff line change @@ -175,5 +175,5 @@ func TestMethodsSEmbedS1AndSEmbedS1(t test.SEmbedS1AndSEmbedS1) {
175175func TestMethodsRedefinedI1 (t test.RedefinedI1 ) {
176176 x := t .Source ()
177177 y := t .Step (x )
178- t .Sink (y ) // $ ql_I1 MISSING: I1[f] I1[t] SPURIOUS: ql_P1 ql_S1
178+ t .Sink (y ) // $ I1[f] I1[t] ql_I1 SPURIOUS: ql_P1 ql_S1
179179}
You can’t perform that action at this time.
0 commit comments