Skip to content

Commit

Permalink
Merge pull request #18663 from github/main
Browse files Browse the repository at this point in the history
Merge main into codeql-cli-2.20.4
  • Loading branch information
aibaars authored Feb 3, 2025
2 parents e39ad94 + 5e92763 commit 49a3067
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
6 changes: 5 additions & 1 deletion cpp/ql/lib/semmle/code/cpp/commons/Buffer.qll
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ private Class getRootType(FieldAccess fa) {
exists(VariableAccess root |
root = fa.getQualifier+() and
not exists(root.getQualifier()) and
result = root.getUnspecifiedType()
// We strip the type because the root may be a pointer. For example `p` in:
// struct S { char buffer[10]; };
// S* p = ...;
// strcpy(p->buffer, "abc");
result = root.getUnspecifiedType().stripType()
)
}

Expand Down
13 changes: 8 additions & 5 deletions java/ql/lib/semmle/code/java/security/CommandLineQuery.qll
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,15 @@ module InputToArgumentToExecFlowConfig implements DataFlow::ConfigSig {
any(CommandInjectionAdditionalTaintStep s).step(n1, n2)
}

// It's valid to use diff-informed data flow for this configuration because
// the location of the selected element in the query is contained inside the
// location of the sink. The query, as a predicate, is used negated in
// another query, but that's only to prevent overlapping results between two
// queries.
// The query, as a predicate, is used negated in another query, but that's
// only to prevent overlapping results between two queries.
predicate observeDiffInformedIncrementalMode() { any() }

// All queries use the argument as the primary location and do not use the
// sink as an associated location.
Location getASelectedSinkLocation(DataFlow::Node sink) {
exists(Expr argument | argumentToExec(argument, sink) | result = argument.getLocation())
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ module WebviewDebugEnabledConfig implements DataFlow::ConfigSig {
}

predicate observeDiffInformedIncrementalMode() { any() }

Location getASelectedSourceLocation(DataFlow::Node source) {
// This module is only used in `WebviewDebuggingEnabled.ql`, which doesn't
// select the source in any "$@" column.
none()
}
}

/**
Expand Down

0 comments on commit 49a3067

Please sign in to comment.