From d97733908b2d438b6d095452ce123e44e5486e6b Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Wed, 14 Sep 2022 19:13:10 +0200 Subject: [PATCH 1/3] ci: rename codeql-analysis.yml to codeql.yml Just to be consistent with other repos under the systemd umbrella. --- .github/workflows/{codeql-analysis.yml => codeql.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{codeql-analysis.yml => codeql.yml} (100%) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql.yml similarity index 100% rename from .github/workflows/codeql-analysis.yml rename to .github/workflows/codeql.yml From 5e781e07db1b657488a3c52a072bb72e5ed4f051 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Wed, 14 Sep 2022 21:32:33 +0200 Subject: [PATCH 2/3] ci: enable a couple more possibly useful CodeQL queries --- .github/codeql-custom.qls | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/codeql-custom.qls b/.github/codeql-custom.qls index 28a22d3aab..d35fbe3114 100644 --- a/.github/codeql-custom.qls +++ b/.github/codeql-custom.qls @@ -10,12 +10,20 @@ # - https://github.com/github/codeql-action/issues/430#issuecomment-806092120 # - https://codeql.github.com/docs/codeql-cli/creating-codeql-query-suites/ +# Note: the codeql/-queries pack name can be found in the CodeQL repo[0] +# in /ql/src/qlpack.yml. The respective codeql-suites are then +# under /ql/src/codeql-suites/. +# +# [0] https://github.com/github/codeql - import: codeql-suites/cpp-lgtm.qls from: codeql/cpp-queries +- import: codeql-suites/python-lgtm.qls + from: codeql/python-queries - include: id: - cpp/bad-strncpy-size - cpp/declaration-hides-variable + - cpp/include-non-header - cpp/inconsistent-null-check - cpp/mistyped-function-arguments - cpp/nested-loops-with-same-variable From 9fe61660bae81acfa5c387ba68c51c643b175510 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Wed, 14 Sep 2022 22:04:15 +0200 Subject: [PATCH 3/3] ci: fix a couple of typos --- .../UninitializedVariableWithCleanup.ql | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/codeql-queries/UninitializedVariableWithCleanup.ql b/.github/codeql-queries/UninitializedVariableWithCleanup.ql index 6b3b62f8bc..e514111f28 100644 --- a/.github/codeql-queries/UninitializedVariableWithCleanup.ql +++ b/.github/codeql-queries/UninitializedVariableWithCleanup.ql @@ -50,16 +50,16 @@ class UninitialisedLocalReachability extends StackVariableReachability { * fun(&x); * puts(x); * - * `useOfVarActual()` won't treat this an an uninitialized read even if the callee + * `useOfVarActual()` won't treat this as an uninitialized read even if the callee * doesn't modify the argument, however, `useOfVar()` will */ override predicate isSink(ControlFlowNode node, StackVariable v) { useOfVar(v, node) } override predicate isBarrier(ControlFlowNode node, StackVariable v) { - // only report the _first_ possibly uninitialized use + /* only report the _first_ possibly uninitialized use */ useOfVar(v, node) or ( - /* If there's an return statement somewhere between the variable declaration + /* If there's a return statement somewhere between the variable declaration * and a possible definition, don't accept is as a valid initialization. * * E.g.: @@ -71,7 +71,7 @@ class UninitialisedLocalReachability extends StackVariableReachability { * x = malloc(...); * * is not a valid initialization, since we might return from the function - * _before_ the actual iniitialization (emphasis on _might_, since we + * _before_ the actual initialization (emphasis on _might_, since we * don't know if the return statement might ever evaluate to true). */ definitionBarrier(v, node) and @@ -92,14 +92,14 @@ predicate containsInlineAssembly(Function f) { exists(AsmStmt s | s.getEnclosing * for this check to exclude them. */ VariableAccess commonException() { - // If the uninitialized use we've found is in a macro expansion, it's - // typically something like va_start(), and we don't want to complain. + /* If the uninitialized use we've found is in a macro expansion, it's + * typically something like va_start(), and we don't want to complain. */ result.getParent().isInMacroExpansion() or result.getParent() instanceof BuiltInOperation or - // Finally, exclude functions that contain assembly blocks. It's - // anyone's guess what happens in those. + /* Finally, exclude functions that contain assembly blocks. It's + * anyone's guess what happens in those. */ containsInlineAssembly(result.getEnclosingFunction()) }