mirror of
https://github.com/github/codeql.git
synced 2026-01-30 14:52:57 +01:00
Add further hints that the range of possible addressed fields, and therefore the interesting selector expressions, are small
This commit is contained in:
committed by
Owen Mansel-Chan
parent
22a3fccf79
commit
9444774895
@@ -48,13 +48,13 @@ private predicate isCond(Expr e) {
|
||||
e = any(ParenExpr par | isCond(par)).getExpr()
|
||||
}
|
||||
|
||||
private class PromotedField extends Field {
|
||||
PromotedField() { this = any(StructType t).getFieldOfEmbedded(_, _, _, _) }
|
||||
private Type getSelectedStructType(PromotedFieldSelector e) {
|
||||
pragma[only_bind_into](result) = e.getBase().getType().getBaseType*().getUnderlyingType()
|
||||
}
|
||||
|
||||
private predicate implicitFieldSelection(SelectorExpr e, int i, Field implicitField) {
|
||||
private predicate implicitFieldSelection(PromotedFieldSelector e, int i, Field implicitField) {
|
||||
exists(StructType baseType, PromotedField child |
|
||||
baseType = e.getBase().getType().getBaseType*().getUnderlyingType() and
|
||||
baseType = getSelectedStructType(e) and
|
||||
(
|
||||
e.refersTo(child)
|
||||
or
|
||||
@@ -65,6 +65,14 @@ private predicate implicitFieldSelection(SelectorExpr e, int i, Field implicitFi
|
||||
)
|
||||
}
|
||||
|
||||
private class PromotedFieldSelector extends SelectorExpr {
|
||||
PromotedFieldSelector() { this.refersTo(any(PromotedField f)) }
|
||||
}
|
||||
|
||||
private class PromotedField extends Field {
|
||||
PromotedField() { this = any(StructType t).getFieldOfEmbedded(_, _, _, _) }
|
||||
}
|
||||
|
||||
/**
|
||||
* A node in the intra-procedural control-flow graph of a Go function or file.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user