Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

Commit 0afa0e7

Browse files
authored
Merge pull request #374 from smowton/smowton/feature/more-accurate-allocation-overflow
Improve accuracy of allocation-size-overflow by excluding len(...) calls that never see a large operand
2 parents 59f8717 + 83a7411 commit 0afa0e7

File tree

11 files changed

+3209
-7
lines changed

11 files changed

+3209
-7
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ build/testdb/go.dbscheme: upgrades/initial/go.dbscheme
131131

132132
.PHONY: sync-dataflow-libraries
133133
sync-dataflow-libraries:
134-
for f in DataFlowImpl.qll DataFlowImplCommon.qll tainttracking1/TaintTrackingImpl.qll;\
134+
for f in DataFlowImpl.qll DataFlowImpl2.qll DataFlowImplCommon.qll tainttracking1/TaintTrackingImpl.qll tainttracking2/TaintTrackingImpl.qll;\
135135
do\
136136
curl -s -o ./ql/src/semmle/go/dataflow/internal/$$f https://raw.githubusercontent.com/github/codeql/$(DATAFLOW_BRANCH)/java/ql/src/semmle/code/java/dataflow/internal/$$f;\
137137
done
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
lgtm,codescanning
2+
* The accuracy of the `go/allocation-size-overflow` query was removed, excluding more false-positives in which a small array could be mistaken for one of unbounded size.

ql/src/go.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ import semmle.go.controlflow.BasicBlocks
2323
import semmle.go.controlflow.ControlFlowGraph
2424
import semmle.go.controlflow.IR
2525
import semmle.go.dataflow.DataFlow
26+
import semmle.go.dataflow.DataFlow2
2627
import semmle.go.dataflow.GlobalValueNumbering
2728
import semmle.go.dataflow.SSA
2829
import semmle.go.dataflow.TaintTracking
30+
import semmle.go.dataflow.TaintTracking2
2931
import semmle.go.frameworks.Chi
3032
import semmle.go.frameworks.Echo
3133
import semmle.go.frameworks.Email
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* Provides a library for local (intra-procedural) and global (inter-procedural)
3+
* data flow analysis: deciding whether data can flow from a _source_ to a
4+
* _sink_.
5+
*
6+
* Unless configured otherwise, _flow_ means that the exact value of
7+
* the source may reach the sink. We do not track flow across pointer
8+
* dereferences or array indexing. To track these types of flow, where the
9+
* exact value may not be preserved, import
10+
* `semmle.code.go.dataflow.TaintTracking`.
11+
*
12+
* To use global (interprocedural) data flow, extend the class
13+
* `DataFlow::Configuration` as documented on that class. To use local
14+
* (intraprocedural) data flow, invoke `DataFlow::localFlow` or
15+
* `DataFlow::LocalFlowStep` with arguments of type `DataFlow::Node`.
16+
*/
17+
18+
import go
19+
20+
/**
21+
* Provides a library for local (intra-procedural) and global (inter-procedural)
22+
* data flow analysis.
23+
*/
24+
module DataFlow2 {
25+
import semmle.go.dataflow.internal.DataFlowImpl2
26+
import Properties
27+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* Provides classes for performing local (intra-procedural) and
3+
* global (inter-procedural) taint-tracking analyses.
4+
*/
5+
module TaintTracking2 {
6+
import semmle.go.dataflow.internal.tainttracking2.TaintTrackingImpl
7+
}

0 commit comments

Comments
 (0)