mirror of
https://github.com/github/codeql.git
synced 2026-01-30 06:42:57 +01:00
Merge pull request #625 from smowton/smowton/fix/minor-perf-improvements
Improve performance: join-order AllocationSizeOverflow's source and use `matches` not `regexpFind`
This commit is contained in:
@@ -49,7 +49,8 @@ module AllocationSizeOverflow {
|
||||
class MarshalingSource extends Source {
|
||||
MarshalingSource() {
|
||||
exists(MarshalingFunction marshal, DataFlow::CallNode call |
|
||||
call = marshal.getACall() and
|
||||
// Binding order tweak: start with marshalling function calls then work outwards:
|
||||
pragma[only_bind_into](call) = marshal.getACall() and
|
||||
// rule out cases where we can tell that the result will always be small
|
||||
exists(FunctionInput inp | inp = marshal.getAnInput() | isBig(inp.getNode(call).asExpr())) and
|
||||
this = marshal.getOutput().getNode(call)
|
||||
|
||||
@@ -26,7 +26,10 @@ class DebugModeFlag extends FlagKind {
|
||||
|
||||
bindingset[result]
|
||||
override string getAFlagName() {
|
||||
result.regexpMatch("(?i).*(trace|debug|devel|(enable|disable|print)stack).*")
|
||||
result
|
||||
.toLowerCase()
|
||||
.matches("%" + ["trace", "debug", "devel", "enablestack", "disablestack", "printstack"] +
|
||||
"%")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ class InsecureCertificateFlag extends FlagKind {
|
||||
|
||||
bindingset[result]
|
||||
override string getAFlagName() {
|
||||
result.regexpMatch("(?i).*(selfCert|selfSign|validat|verif|trust).*")
|
||||
result.toLowerCase().matches("%" + ["selfcert", "selfsign", "validat", "verif", "trust"] + "%")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -243,7 +243,9 @@ class LegacyTlsVersionFlag extends FlagKind {
|
||||
LegacyTlsVersionFlag() { this = "legacyTlsVersion" }
|
||||
|
||||
bindingset[result]
|
||||
override string getAFlagName() { result.regexpMatch("(?i).*(old|intermediate|legacy).*") }
|
||||
override string getAFlagName() {
|
||||
result.toLowerCase().matches("%" + ["old", "intermediate", "legacy"] + "%")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,7 +22,9 @@ class AllowedFlag extends FlagKind {
|
||||
|
||||
bindingset[result]
|
||||
override string getAFlagName() {
|
||||
result.regexpMatch("(?i).*(allow|match|check|debug|devel|insecure).*")
|
||||
result
|
||||
.toLowerCase()
|
||||
.matches("%" + ["allow", "match", "check", "debug", "devel", "insecure"] + "%")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user