mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Merge pull request #16509 from owen-mc/go/fix-missing-underlying-types
Go: make two barriers recognise named types whose underlying types are integer types
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
---
|
||||
category: minorAnalysis
|
||||
---
|
||||
* A bug has been fixed which meant that the query `go/incorrect-integer-conversion` did not consider type assertions and type switches which use a defined type whose underlying type is an integer type. This may lead to fewer false positive alerts.
|
||||
@@ -422,7 +422,7 @@ class TypeAssertionCheck extends DataFlow::ExprNode, FlowStateTransformer {
|
||||
TypeAssertionCheck() {
|
||||
exists(TypeAssertExpr tae |
|
||||
this = DataFlow::exprNode(tae.getExpr()) and
|
||||
it = tae.getTypeExpr().getType()
|
||||
it = tae.getTypeExpr().getType().getUnderlyingType()
|
||||
)
|
||||
}
|
||||
|
||||
@@ -442,7 +442,7 @@ class TypeSwitchVarFlowStateTransformer extends DataFlow::SsaNode, FlowStateTran
|
||||
TypeSwitchVarFlowStateTransformer() {
|
||||
exists(IR::TypeSwitchImplicitVariableInstruction insn, LocalVariable lv | insn.writes(lv, _) |
|
||||
this.getSourceVariable() = lv and
|
||||
it = lv.getType()
|
||||
it = lv.getType().getUnderlyingType()
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user