Skip to content

Commit 7e8bc4a

Browse files
committed
Merge commit '2fa9037' into yo-h/java15-merge
2 parents eedc385 + 2fa9037 commit 7e8bc4a

File tree

1,112 files changed

+74202
-32059
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,112 files changed

+74202
-32059
lines changed

config/identical-files.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,14 @@
358358
"cpp/ql/test/TestUtilities/InlineExpectationsTest.qll",
359359
"python/ql/test/TestUtilities/InlineExpectationsTest.qll"
360360
],
361+
"C++ ExternalAPIs": [
362+
"cpp/ql/src/Security/CWE/CWE-020/ExternalAPIs.qll",
363+
"cpp/ql/src/Security/CWE/CWE-020/ir/ExternalAPIs.qll"
364+
],
365+
"C++ SafeExternalAPIFunction": [
366+
"cpp/ql/src/Security/CWE/CWE-020/SafeExternalAPIFunction.qll",
367+
"cpp/ql/src/Security/CWE/CWE-020/ir/SafeExternalAPIFunction.qll"
368+
],
361369
"XML": [
362370
"cpp/ql/src/semmle/code/cpp/XML.qll",
363371
"csharp/ql/src/semmle/code/csharp/XML.qll",
@@ -409,5 +417,12 @@
409417
"java/ql/src/Metrics/Files/CommentedOutCodeReferences.qhelp",
410418
"javascript/ql/src/Comments/CommentedOutCodeReferences.qhelp",
411419
"python/ql/src/Lexical/CommentedOutCodeReferences.qhelp"
420+
],
421+
"IDE Contextual Queries": [
422+
"cpp/ql/src/IDEContextual.qll",
423+
"csharp/ql/src/IDEContextual.qll",
424+
"java/ql/src/IDEContextual.qll",
425+
"javascript/ql/src/IDEContextual.qll",
426+
"python/ql/src/analysis/IDEContextual.qll"
412427
]
413428
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
lgtm,codescanning
2+
* Two issues causing the 'Unused local variable' query (`cpp/unused-local-variable`) to produce false positive results have been fixed.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
lgtm,codescanning
2+
* Various classes in `semmle.code.cpp.models.implementations` have been made private. Users should not depend on library implementation details.
3+
* The `OperatorNewAllocationFunction`, `OperatorDeleteDeallocationFunction`, `Iterator` and `Snprintf` classes now have interfaces in `semmle.code.cpp.models.interfaces`.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
lgtm,codescanning
2+
* A new query (`cpp/unsafe-use-of-this`) has been added. The query finds pure virtual function calls whose qualifier is an object under construction.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
lgtm,codescanning
2+
* The queries `cpp/local-variable-hides-global-variable` and `cpp/missing-header-guard` now have severity `recommendation` instead of `warning`.

cpp/config/suites/cpp/correctness

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
+ semmlecode-cpp-queries/Likely Bugs/Conversion/CastArrayPointerArithmetic.ql: /Correctness/Dangerous Conversions
1010
+ semmlecode-cpp-queries/Likely Bugs/Underspecified Functions/MistypedFunctionArguments.ql: /Correctness/Dangerous Conversions
1111
+ semmlecode-cpp-queries/Security/CWE/CWE-253/HResultBooleanConversion.ql: /Correctness/Dangerous Conversions
12+
+ semmlecode-cpp-queries/Likely Bugs/OO/UnsafeUseOfThis.ql: /Correctness/Dangerous Conversions
1213
# Consistent Use
1314
+ semmlecode-cpp-queries/Critical/ReturnValueIgnored.ql: /Correctness/Consistent Use
1415
+ semmlecode-cpp-queries/Likely Bugs/InconsistentCheckReturnNull.ql: /Correctness/Consistent Use

cpp/ql/src/Best Practices/Hiding/LocalVariableHidesGlobalVariable.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @name Local variable hides global variable
33
* @description A local variable or parameter that hides a global variable of the same name. This may be confusing. Consider renaming one of the variables.
44
* @kind problem
5-
* @problem.severity warning
5+
* @problem.severity recommendation
66
* @precision very-high
77
* @id cpp/local-variable-hides-global-variable
88
* @tags maintainability

cpp/ql/src/Best Practices/Unused Entities/UnusedLocals.ql

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,12 @@ where
5757
not declarationHasSideEffects(v) and
5858
not exists(AsmStmt s | f = s.getEnclosingFunction()) and
5959
not v.getAnAttribute().getName() = "unused" and
60-
not any(ErrorExpr e).getEnclosingFunction() = f // unextracted expr likely used `v`
60+
not any(ErrorExpr e).getEnclosingFunction() = f and // unextracted expr may use `v`
61+
not exists(
62+
Literal l // this case can be removed when the `myFunction2( [obj](){} );` test case doesn't depend on this exclusion
63+
|
64+
l.getEnclosingFunction() = f and
65+
not exists(l.getValue())
66+
) and
67+
not any(ConditionDeclExpr cde).getEnclosingFunction() = f // this case can be removed when the `if (a = b; a)` test case doesn't depend on this exclusion
6168
select v, "Variable " + v.getName() + " is not used"

cpp/ql/src/Critical/NewDelete.qll

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
import cpp
66
import semmle.code.cpp.controlflow.SSA
77
import semmle.code.cpp.dataflow.DataFlow
8-
import semmle.code.cpp.models.implementations.Allocation
9-
import semmle.code.cpp.models.implementations.Deallocation
108

119
/**
1210
* Holds if `alloc` is a use of `malloc` or `new`. `kind` is

cpp/ql/src/IDEContextual.qll

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* Provides shared predicates related to contextual queries in the code viewer.
3+
*/
4+
5+
import semmle.files.FileSystem
6+
7+
/**
8+
* Returns the `File` matching the given source file name as encoded by the VS
9+
* Code extension.
10+
*/
11+
cached
12+
File getFileBySourceArchiveName(string name) {
13+
// The name provided for a file in the source archive by the VS Code extension
14+
// has some differences from the absolute path in the database:
15+
// 1. colons are replaced by underscores
16+
// 2. there's a leading slash, even for Windows paths: "C:/foo/bar" ->
17+
// "/C_/foo/bar"
18+
// 3. double slashes in UNC prefixes are replaced with a single slash
19+
// We can handle 2 and 3 together by unconditionally adding a leading slash
20+
// before replacing double slashes.
21+
name = ("/" + result.getAbsolutePath().replaceAll(":", "_")).replaceAll("//", "/")
22+
}

0 commit comments

Comments
 (0)