Skip to content

Commit 08ea30e

Browse files
committed
Fix bug in InterpretNode.asCallable
It was only working for summarized callables.
1 parent 8e481bd commit 08ea30e

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

go/ql/lib/semmle/go/dataflow/internal/FlowSummaryImpl.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,9 @@ module SourceSinkInterpretationInput implements
252252

253253
/** Gets the callable that this node corresponds to, if any. */
254254
DataFlowCallable asCallable() {
255-
result.asSummarizedCallable().asFunction() = this.asElement().asEntity()
255+
this.asElement().asEntity() = result.asSummarizedCallable().asFunction() or
256+
this.asElement().asEntity() = result.asCallable().asFunction() or
257+
this.asElement().asAstNode() = result.asCallable().asFuncLit()
256258
}
257259

258260
/** Gets the target of this call, if any. */

go/ql/test/library-tests/semmle/go/dataflow/ExternalTaintFlow/srcs.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ invalidModelRow
2222
| test.go:187:24:187:31 | call to Src1 | qltest |
2323
| test.go:191:24:191:31 | call to Src1 | qltest |
2424
| test.go:201:10:201:28 | selection of SourceVariable | qltest |
25+
| test.go:205:15:205:17 | definition of src | qltest |

go/ql/test/library-tests/semmle/go/dataflow/ExternalTaintFlow/test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ func simpleflow() {
203203
}
204204

205205
func srcParam(src string, b test.B) {
206-
b.Sink1(src) // $ MISSING: hasTaintFlow="src"
206+
b.Sink1(src) // $ hasTaintFlow="src"
207207
}
208208

209209
type mapstringstringtype map[string]string

0 commit comments

Comments
 (0)